103 changed files with 6711 additions and 3803 deletions
@ -0,0 +1,3 @@ |
|||||||
|
doc/tags |
||||||
|
*.lock |
||||||
|
.vim-flavor |
@ -0,0 +1,4 @@ |
|||||||
|
language: ruby |
||||||
|
rvm: |
||||||
|
- 1.9.3 |
||||||
|
script: rake ci |
@ -0,0 +1,2 @@ |
|||||||
|
source 'https://rubygems.org' |
||||||
|
gem 'vim-flavor', '~> 1.1' |
@ -0,0 +1,14 @@ |
|||||||
|
#!/usr/bin/env rake |
||||||
|
|
||||||
|
task :default => [:test] |
||||||
|
|
||||||
|
task :ci => [:dump, :test] |
||||||
|
|
||||||
|
task :dump do |
||||||
|
sh 'vim --version' |
||||||
|
end |
||||||
|
|
||||||
|
task :test do |
||||||
|
sh 'bundle exec vim-flavor test' |
||||||
|
end |
||||||
|
|
@ -0,0 +1,74 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
let s:prototype = {} |
||||||
|
|
||||||
|
function! s:prototype.split(...) |
||||||
|
let self._side = 0 |
||||||
|
let self._line .= '%#'.self._curgroup.'#'.(a:0 ? a:1 : '%=') |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:prototype.add_section_spaced(group, contents) |
||||||
|
call self.add_section(a:group, (g:airline_symbols.space).a:contents.(g:airline_symbols.space)) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:prototype.add_section(group, contents) |
||||||
|
if self._curgroup != '' |
||||||
|
if self._curgroup == a:group |
||||||
|
let self._line .= self._side ? self._context.left_alt_sep : self._context.right_alt_sep |
||||||
|
else |
||||||
|
call airline#highlighter#add_separator(self._curgroup, a:group, self._side) |
||||||
|
let self._line .= '%#'.self._curgroup.'_to_'.a:group.'#' |
||||||
|
let self._line .= self._side ? self._context.left_sep : self._context.right_sep |
||||||
|
endif |
||||||
|
endif |
||||||
|
|
||||||
|
if self._curgroup != a:group |
||||||
|
let self._line .= '%#'.a:group.'#' |
||||||
|
endif |
||||||
|
|
||||||
|
if self._context.active |
||||||
|
let contents = [] |
||||||
|
let content_parts = split(a:contents, '__accent') |
||||||
|
for cpart in content_parts |
||||||
|
let accent = matchstr(cpart, '_\zs[^#]*\ze') |
||||||
|
call add(contents, cpart) |
||||||
|
endfor |
||||||
|
let line = join(contents, a:group) |
||||||
|
let line = substitute(line, '__restore__', a:group, 'g') |
||||||
|
else |
||||||
|
let line = substitute(a:contents, '%#__accent[^#]*#', '', 'g') |
||||||
|
let line = substitute(line, '%#__restore__#', '', 'g') |
||||||
|
endif |
||||||
|
|
||||||
|
let self._line .= line |
||||||
|
let self._curgroup = a:group |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:prototype.add_raw(text) |
||||||
|
let self._line .= a:text |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:prototype.build() |
||||||
|
if !self._context.active |
||||||
|
let self._line = substitute(self._line, '%#.\{-}\ze#', '\0_inactive', 'g') |
||||||
|
endif |
||||||
|
return self._line |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#builder#new(context) |
||||||
|
let builder = copy(s:prototype) |
||||||
|
let builder._context = a:context |
||||||
|
let builder._side = 1 |
||||||
|
let builder._curgroup = '' |
||||||
|
let builder._line = '' |
||||||
|
|
||||||
|
call extend(builder._context, { |
||||||
|
\ 'left_sep': g:airline_left_sep, |
||||||
|
\ 'left_alt_sep': g:airline_left_alt_sep, |
||||||
|
\ 'right_sep': g:airline_right_sep, |
||||||
|
\ 'right_alt_sep': g:airline_right_alt_sep, |
||||||
|
\ }, 'keep') |
||||||
|
return builder |
||||||
|
endfunction |
||||||
|
|
@ -0,0 +1,50 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
function! airline#debug#profile1() |
||||||
|
profile start airline-profile-switch.log |
||||||
|
profile func * |
||||||
|
profile file * |
||||||
|
split |
||||||
|
for i in range(1, 1000) |
||||||
|
wincmd w |
||||||
|
redrawstatus |
||||||
|
endfor |
||||||
|
profile pause |
||||||
|
noautocmd qall! |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#debug#profile2() |
||||||
|
profile start airline-profile-cursor.log |
||||||
|
profile func * |
||||||
|
profile file * |
||||||
|
edit blank |
||||||
|
call setline(1, 'all your base are belong to us') |
||||||
|
call setline(2, 'all your base are belong to us') |
||||||
|
let positions = [[1,2], [2,2], [1,2], [1,1]] |
||||||
|
for i in range(1, 1000) |
||||||
|
for pos in positions |
||||||
|
call cursor(pos[0], pos[1]) |
||||||
|
redrawstatus |
||||||
|
endfor |
||||||
|
endfor |
||||||
|
profile pause |
||||||
|
noautocmd qall! |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#debug#profile3() |
||||||
|
profile start airline-profile-mode.log |
||||||
|
profile func * |
||||||
|
profile file * |
||||||
|
|
||||||
|
for i in range(1000) |
||||||
|
startinsert |
||||||
|
redrawstatus |
||||||
|
stopinsert |
||||||
|
redrawstatus |
||||||
|
endfor |
||||||
|
|
||||||
|
profile pause |
||||||
|
noautocmd qall! |
||||||
|
endfunction |
||||||
|
|
@ -0,0 +1,32 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
function! airline#deprecation#check() |
||||||
|
if exists('g:airline_enable_fugitive') || exists('g:airline_fugitive_prefix') |
||||||
|
echom 'The g:airline_enable_fugitive and g:airline_fugitive_prefix variables are obsolete. Please read the documentation about the branch extension.' |
||||||
|
endif |
||||||
|
|
||||||
|
let tests = [ |
||||||
|
\ [ 'g:airline_paste_symbol', 'g:airline_symbols.paste' ], |
||||||
|
\ [ 'g:airline_readonly_symbol', 'g:airline_symbols.readonly' ], |
||||||
|
\ [ 'g:airline_linecolumn_prefix', 'g:airline_symbols.linenr' ], |
||||||
|
\ [ 'g:airline_branch_prefix', 'g:airline_symbols.branch' ], |
||||||
|
\ [ 'g:airline_branch_empty_message', 'g:airline#extensions#branch#empty_message' ], |
||||||
|
\ [ 'g:airline_detect_whitespace', 'g:airline#extensions#whitespace#enabled|show_message' ], |
||||||
|
\ [ 'g:airline_enable_hunks', 'g:airline#extensions#hunks#enabled' ], |
||||||
|
\ [ 'g:airline_enable_tagbar', 'g:airline#extensions#tagbar#enabled' ], |
||||||
|
\ [ 'g:airline_enable_csv', 'g:airline#extensions#csv#enabled' ], |
||||||
|
\ [ 'g:airline_enable_branch', 'g:airline#extensions#branch#enabled' ], |
||||||
|
\ [ 'g:airline_enable_bufferline', 'g:airline#extensions#bufferline#enabled' ], |
||||||
|
\ [ 'g:airline_enable_syntastic', 'g:airline#extensions#syntastic#enabled' ], |
||||||
|
\ [ 'g:airline_enable_eclim', 'g:airline#extensions#eclim#enabled' ], |
||||||
|
\ ] |
||||||
|
for test in tests |
||||||
|
if exists(test[0]) |
||||||
|
let max = winwidth(0) - 16 |
||||||
|
let msg = printf('The variable %s is deprecated and may not work in the future. It has been replaced with %s. Please read the documentation.', test[0], test[1]) |
||||||
|
echom msg[:max].'...' |
||||||
|
endif |
||||||
|
endfor |
||||||
|
endfunction |
||||||
|
|
@ -1,15 +1,66 @@ |
|||||||
" MIT license. Copyright (c) 2013 Bailey Ling. |
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
" vim: ts=2 sts=2 sw=2 fdm=indent |
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
function! airline#extensions#branch#apply() |
let s:has_fugitive = exists('*fugitive#head') |
||||||
let g:airline_current_branch = exists('*fugitive#head') && strlen(fugitive#head()) > 0 |
let s:has_fugitive_detect = exists('*fugitive#detect') |
||||||
\ ? g:airline_branch_prefix.fugitive#head() |
let s:has_lawrencium = exists('*lawrencium#statusline') |
||||||
\ : exists('*lawrencium#statusline') && strlen(lawrencium#statusline()) > 0 |
|
||||||
\ ? g:airline_branch_prefix.lawrencium#statusline() |
if !s:has_fugitive && !s:has_lawrencium |
||||||
\ : '' |
finish |
||||||
|
endif |
||||||
|
|
||||||
|
let s:empty_message = get(g:, 'airline#extensions#branch#empty_message', |
||||||
|
\ get(g:, 'airline_branch_empty_message', '')) |
||||||
|
let s:symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch) |
||||||
|
|
||||||
|
function! airline#extensions#branch#get_head() |
||||||
|
let head = '' |
||||||
|
|
||||||
|
if s:has_fugitive && !exists('b:mercurial_dir') |
||||||
|
let head = fugitive#head() |
||||||
|
|
||||||
|
if empty(head) && s:has_fugitive_detect && !exists('b:git_dir') |
||||||
|
call fugitive#detect(getcwd()) |
||||||
|
let head = fugitive#head() |
||||||
|
endif |
||||||
|
endif |
||||||
|
|
||||||
|
if empty(head) |
||||||
|
if s:has_lawrencium |
||||||
|
let head = lawrencium#statusline() |
||||||
|
endif |
||||||
|
endif |
||||||
|
|
||||||
|
return empty(head) || !s:check_in_path() |
||||||
|
\ ? s:empty_message |
||||||
|
\ : printf('%s%s', empty(s:symbol) ? '' : s:symbol.(g:airline_symbols.space), head) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:check_in_path() |
||||||
|
if !exists('b:airline_branch_path') |
||||||
|
let root = get(b:, 'git_dir', get(b:, 'mercurial_dir', '')) |
||||||
|
let bufferpath = resolve(fnamemodify(expand('%'), ':p:h')) |
||||||
|
|
||||||
|
if !filereadable(root) "not a file |
||||||
|
" if .git is a directory, it's the old submodule format |
||||||
|
if match(root, '\.git$') >= 0 |
||||||
|
let root = expand(fnamemodify(root, ':h')) |
||||||
|
else |
||||||
|
" else it's the newer format, and we need to guesstimate |
||||||
|
let pattern = '\.git\(\\\|\/\)modules\(\\\|\/\)' |
||||||
|
if match(root, pattern) >= 0 |
||||||
|
let root = substitute(root, pattern, '', '') |
||||||
|
endif |
||||||
|
endif |
||||||
|
|
||||||
|
let b:airline_file_in_root = stridx(bufferpath, root) > -1 |
||||||
|
endif |
||||||
|
return b:airline_file_in_root |
||||||
endfunction |
endfunction |
||||||
|
|
||||||
function! airline#extensions#branch#init(ext) |
function! airline#extensions#branch#init(ext) |
||||||
call a:ext.add_statusline_funcref(function('airline#extensions#branch#apply')) |
call airline#parts#define_function('branch', 'airline#extensions#branch#get_head') |
||||||
|
|
||||||
|
autocmd BufReadPost * unlet! b:airline_file_in_root |
||||||
endfunction |
endfunction |
||||||
|
|
||||||
|
@ -1,16 +1,23 @@ |
|||||||
" MIT license. Copyright (c) 2013 Bailey Ling. |
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
" vim: ts=2 sts=2 sw=2 fdm=indent |
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
function! airline#extensions#bufferline#init(ext) |
if !exists('*bufferline#get_status_string') |
||||||
highlight AlBl_active gui=bold cterm=bold term=bold |
finish |
||||||
highlight link AlBl_inactive Al6 |
endif |
||||||
let g:bufferline_inactive_highlight = 'AlBl_inactive' |
|
||||||
let g:bufferline_active_highlight = 'AlBl_active' |
let s:overwrite = get(g:, 'airline#extensions#bufferline#overwrite_variables', 1) |
||||||
let g:bufferline_active_buffer_left = '' |
|
||||||
let g:bufferline_active_buffer_right = '' |
|
||||||
let g:bufferline_separator = ' ' |
|
||||||
|
|
||||||
if g:airline_section_c == '%f%m' |
function! airline#extensions#bufferline#init(ext) |
||||||
let g:airline_section_c = '%{bufferline#refresh_status()}'.bufferline#get_status_string() |
if s:overwrite |
||||||
|
highlight bufferline_selected gui=bold cterm=bold term=bold |
||||||
|
highlight link bufferline_selected_inactive airline_c_inactive |
||||||
|
let g:bufferline_inactive_highlight = 'airline_c' |
||||||
|
let g:bufferline_active_highlight = 'bufferline_selected' |
||||||
|
let g:bufferline_active_buffer_left = '' |
||||||
|
let g:bufferline_active_buffer_right = '' |
||||||
|
let g:bufferline_separator = g:airline_symbols.space |
||||||
endif |
endif |
||||||
|
|
||||||
|
call airline#parts#define_raw('file', '%{bufferline#refresh_status()}'.bufferline#get_status_string()) |
||||||
endfunction |
endfunction |
||||||
|
|
||||||
|
@ -1,12 +1,16 @@ |
|||||||
" MIT license. Copyright (c) 2013 Bailey Ling. |
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
" vim: ts=2 sts=2 sw=2 fdm=indent |
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
function! airline#extensions#commandt#apply() |
if !get(g:, 'command_t_loaded', 0) |
||||||
|
finish |
||||||
|
endif |
||||||
|
|
||||||
|
function! airline#extensions#commandt#apply(...) |
||||||
if bufname('%') ==# 'GoToFile' |
if bufname('%') ==# 'GoToFile' |
||||||
call airline#extensions#apply_left_override('CommandT', '') |
call airline#extensions#apply_left_override('CommandT', '') |
||||||
endif |
endif |
||||||
endfunction |
endfunction |
||||||
|
|
||||||
function! airline#extensions#commandt#init(ext) |
function! airline#extensions#commandt#init(ext) |
||||||
call a:ext.add_statusline_funcref(function('airline#extensions#commandt#apply')) |
call a:ext.add_statusline_func('airline#extensions#commandt#apply') |
||||||
endfunction |
endfunction |
||||||
|
@ -0,0 +1,31 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
if !get(g:, 'loaded_csv', 0) && !exists(':Table') |
||||||
|
finish |
||||||
|
endif |
||||||
|
|
||||||
|
let s:column_display = get(g:, 'airline#extensions#csv#column_display', 'Number') |
||||||
|
|
||||||
|
function! airline#extensions#csv#get_column() |
||||||
|
if exists('*CSV_WCol') |
||||||
|
if s:column_display ==# 'Name' |
||||||
|
return '['.CSV_WCol('Name').CSV_WCol().']' |
||||||
|
else |
||||||
|
return '['.CSV_WCol().']' |
||||||
|
endif |
||||||
|
endif |
||||||
|
return '' |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#csv#apply(...) |
||||||
|
if &ft ==# "csv" |
||||||
|
call airline#extensions#prepend_to_section('gutter', |
||||||
|
\ g:airline_left_alt_sep.' %{airline#extensions#csv#get_column()}') |
||||||
|
endif |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#csv#init(ext) |
||||||
|
call a:ext.add_statusline_func('airline#extensions#csv#apply') |
||||||
|
endfunction |
||||||
|
|
@ -0,0 +1,77 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', { |
||||||
|
\ 'b': 79, |
||||||
|
\ 'x': 60, |
||||||
|
\ 'y': 88, |
||||||
|
\ 'z': 45, |
||||||
|
\ }) |
||||||
|
let s:layout = get(g:, 'airline#extensions#default#layout', [ |
||||||
|
\ [ 'a', 'b', 'c' ], |
||||||
|
\ [ 'x', 'y', 'z', 'warning' ] |
||||||
|
\ ]) |
||||||
|
|
||||||
|
function! s:get_section(winnr, key, ...) |
||||||
|
if has_key(s:section_truncate_width, a:key) |
||||||
|
if winwidth(a:winnr) < s:section_truncate_width[a:key] |
||||||
|
return '' |
||||||
|
endif |
||||||
|
endif |
||||||
|
let spc = g:airline_symbols.space |
||||||
|
let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key}) |
||||||
|
let [prefix, suffix] = [get(a:000, 0, '%('.spc), get(a:000, 1, spc.'%)')] |
||||||
|
return empty(text) ? '' : prefix.text.suffix |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:build_sections(builder, context, keys) |
||||||
|
for key in a:keys |
||||||
|
if key == 'warning' && !a:context.active |
||||||
|
continue |
||||||
|
endif |
||||||
|
call s:add_section(a:builder, a:context, key) |
||||||
|
endfor |
||||||
|
endfunction |
||||||
|
|
||||||
|
if v:version >= 704 || (v:version >= 703 && has('patch81')) |
||||||
|
function s:add_section(builder, context, key) |
||||||
|
" i have no idea why the warning section needs special treatment, but it's |
||||||
|
" needed to prevent separators from showing up |
||||||
|
if a:key == 'warning' |
||||||
|
call a:builder.add_raw('%(') |
||||||
|
endif |
||||||
|
call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key)) |
||||||
|
if a:key == 'warning' |
||||||
|
call a:builder.add_raw('%)') |
||||||
|
endif |
||||||
|
endfunction |
||||||
|
else |
||||||
|
" older version don't like the use of %(%) |
||||||
|
function s:add_section(builder, context, key) |
||||||
|
if a:key == 'warning' |
||||||
|
call a:builder.add_raw('%#airline_warning#'.s:get_section(a:context.winnr, a:key)) |
||||||
|
else |
||||||
|
call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key)) |
||||||
|
endif |
||||||
|
endfunction |
||||||
|
endif |
||||||
|
|
||||||
|
function! airline#extensions#default#apply(builder, context) |
||||||
|
let winnr = a:context.winnr |
||||||
|
let active = a:context.active |
||||||
|
|
||||||
|
if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse)) |
||||||
|
call <sid>build_sections(a:builder, a:context, s:layout[0]) |
||||||
|
else |
||||||
|
call a:builder.add_section('airline_c'.(a:context.bufnr), ' %f%m ') |
||||||
|
endif |
||||||
|
|
||||||
|
call a:builder.split(s:get_section(winnr, 'gutter', '', '')) |
||||||
|
|
||||||
|
if airline#util#getwinvar(winnr, 'airline_render_right', 1) |
||||||
|
call <sid>build_sections(a:builder, a:context, s:layout[1]) |
||||||
|
endif |
||||||
|
|
||||||
|
return 1 |
||||||
|
endfunction |
||||||
|
|
@ -0,0 +1,35 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
if !exists(':ProjectCreate') |
||||||
|
finish |
||||||
|
endif |
||||||
|
|
||||||
|
function! airline#extensions#eclim#creat_line(...) |
||||||
|
if &filetype == "tree" |
||||||
|
let builder = a:1 |
||||||
|
call builder.add_section('airline_a', ' Project ') |
||||||
|
call builder.add_section('airline_b', ' %f ') |
||||||
|
call builder.add_section('airline_c', '') |
||||||
|
return 1 |
||||||
|
endif |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#eclim#get_warnings() |
||||||
|
let eclimList = eclim#display#signs#GetExisting() |
||||||
|
if !empty(eclimList) |
||||||
|
let errorsLine = eclimList[0]['line'] |
||||||
|
let errorsNumber = len(eclimList) |
||||||
|
let errors = "[Eclim: line:".string(errorsLine)." (".string(errorsNumber).")]" |
||||||
|
if !exists(':SyntasticCheck') || SyntasticStatuslineFlag() == '' |
||||||
|
return errors.(g:airline_symbols.space) |
||||||
|
endif |
||||||
|
endif |
||||||
|
return '' |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#eclim#init(ext) |
||||||
|
call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings') |
||||||
|
call a:ext.add_statusline_func('airline#extensions#eclim#creat_line') |
||||||
|
endfunction |
||||||
|
|
@ -0,0 +1,54 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
" we don't actually want this loaded :P |
||||||
|
finish |
||||||
|
|
||||||
|
" Due to some potential rendering issues, the use of the `space` variable is |
||||||
|
" recommended. |
||||||
|
let s:spc = g:airline_symbols.space |
||||||
|
|
||||||
|
" Extension specific variables can be defined the usual fashion. |
||||||
|
if !exists('g:airline#extensions#example#number_of_cats') |
||||||
|
let g:airline#extensions#example#number_of_cats = 42 |
||||||
|
endif |
||||||
|
|
||||||
|
" First we define an init function that will be invoked from extensions.vim |
||||||
|
function! airline#extensions#example#init(ext) |
||||||
|
|
||||||
|
" Here we define a new part for the plugin. This allows users to place this |
||||||
|
" extension in arbitrary locations. |
||||||
|
call airline#parts#define_raw('cats', '%{airline#extensions#example#get_cats()}') |
||||||
|
|
||||||
|
" Next up we add a funcref so that we can run some code prior to the |
||||||
|
" statusline getting modifed. |
||||||
|
call a:ext.add_statusline_func('airline#extensions#example#apply') |
||||||
|
|
||||||
|
" You can also add a funcref for inactive statuslines. |
||||||
|
" call a:ext.add_inactive_statusline_func('airline#extensions#example#unapply') |
||||||
|
endfunction |
||||||
|
|
||||||
|
" This function will be invoked just prior to the statusline getting modified. |
||||||
|
function! airline#extensions#example#apply(...) |
||||||
|
" First we check for the filetype. |
||||||
|
if &filetype == "nyancat" |
||||||
|
|
||||||
|
" Let's say we want to append to section_c, first we check if there's |
||||||
|
" already a window-local override, and if not, create it off of the global |
||||||
|
" section_c. |
||||||
|
let w:airline_section_c = get(w:, 'airline_section_c', g:airline_section_c) |
||||||
|
|
||||||
|
" Then we just append this extenion to it, optionally using separators. |
||||||
|
let w:airline_section_c .= s:spc.g:airline_left_alt_sep.s:spc.'%{airline#extensions#example#get_cats()}' |
||||||
|
endif |
||||||
|
endfunction |
||||||
|
|
||||||
|
" Finally, this function will be invoked from the statusline. |
||||||
|
function! airline#extensions#example#get_cats() |
||||||
|
let cats = '' |
||||||
|
for i in range(1, g:airline#extensions#example#number_of_cats) |
||||||
|
let cats .= ' (,,,)=(^.^)=(,,,) ' |
||||||
|
endfor |
||||||
|
return cats |
||||||
|
endfunction |
||||||
|
|
@ -0,0 +1,63 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) |
||||||
|
finish |
||||||
|
endif |
||||||
|
|
||||||
|
let s:non_zero_only = get(g:, 'airline#extensions#hunks#non_zero_only', 0) |
||||||
|
let s:hunk_symbols = get(g:, 'airline#extensions#hunks#hunk_symbols', ['+', '~', '-']) |
||||||
|
|
||||||
|
function! s:get_hunks_signify() |
||||||
|
let hunks = sy#repo#get_stats() |
||||||
|
if hunks[0] >= 0 |
||||||
|
return hunks |
||||||
|
endif |
||||||
|
return [] |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:get_hunks_gitgutter() |
||||||
|
if !get(g:, 'gitgutter_enabled', 0) |
||||||
|
return '' |
||||||
|
endif |
||||||
|
return GitGutterGetHunkSummary() |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:get_hunks_empty() |
||||||
|
return '' |
||||||
|
endfunction |
||||||
|
|
||||||
|
let s:source_func = '' |
||||||
|
function! s:get_hunks() |
||||||
|
if empty(s:source_func) |
||||||
|
if get(g:, 'loaded_signify', 0) |
||||||
|
let s:source_func = 's:get_hunks_signify' |
||||||
|
elseif exists('*GitGutterGetHunkSummary') |
||||||
|
let s:source_func = 's:get_hunks_gitgutter' |
||||||
|
else |
||||||
|
let s:source_func = 's:get_hunks_empty' |
||||||
|
endif |
||||||
|
endif |
||||||
|
return {s:source_func}() |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#hunks#get_hunks() |
||||||
|
if !get(w:, 'airline_active', 0) |
||||||
|
return '' |
||||||
|
endif |
||||||
|
let hunks = s:get_hunks() |
||||||
|
let string = '' |
||||||
|
if !empty(hunks) |
||||||
|
for i in [0, 1, 2] |
||||||
|
if s:non_zero_only == 0 || hunks[i] > 0 |
||||||
|
let string .= printf('%s%s ', s:hunk_symbols[i], hunks[i]) |
||||||
|
endif |
||||||
|
endfor |
||||||
|
endif |
||||||
|
return string |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#hunks#init(ext) |
||||||
|
call airline#parts#define_function('hunks', 'airline#extensions#hunks#get_hunks') |
||||||
|
endfunction |
||||||
|
|
@ -1,12 +1,19 @@ |
|||||||
" MIT license. Copyright (c) 2013 Bailey Ling. |
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
" vim: ts=2 sts=2 sw=2 fdm=indent |
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
function! airline#extensions#syntastic#apply() |
if !exists(':SyntasticCheck') |
||||||
if exists('w:airline_active') && w:airline_active |
finish |
||||||
let w:airline_section_warning = ' %#warningmsg#%{SyntasticStatuslineFlag()}' |
endif |
||||||
|
|
||||||
|
function! airline#extensions#syntastic#get_warnings() |
||||||
|
let errors = SyntasticStatuslineFlag() |
||||||
|
if strlen(errors) > 0 |
||||||
|
return errors.(g:airline_symbols.space) |
||||||
endif |
endif |
||||||
|
return '' |
||||||
endfunction |
endfunction |
||||||
|
|
||||||
function! airline#extensions#syntastic#init(ext) |
function! airline#extensions#syntastic#init(ext) |
||||||
call a:ext.add_statusline_funcref(function('airline#extensions#syntastic#apply')) |
call airline#parts#define_function('syntastic', 'airline#extensions#syntastic#get_warnings') |
||||||
endfunction |
endfunction |
||||||
|
|
||||||
|
@ -0,0 +1,225 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default') |
||||||
|
let s:excludes = get(g:, 'airline#extensions#tabline#excludes', []) |
||||||
|
let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) |
||||||
|
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) |
||||||
|
|
||||||
|
let s:builder_context = { |
||||||
|
\ 'active' : 1, |
||||||
|
\ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep), |
||||||
|
\ 'right_alt_sep' : get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep), |
||||||
|
\ } |
||||||
|
if get(g:, 'airline_powerline_fonts', 0) |
||||||
|
let s:builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , "\ue0b0") |
||||||
|
let s:builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , "\ue0b1") |
||||||
|
else |
||||||
|
let s:builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , ' ') |
||||||
|
let s:builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|') |
||||||
|
endif |
||||||
|
|
||||||
|
let s:buf_min_count = get(g:, 'airline#extensions#tabline#buffer_min_count', 0) |
||||||
|
let s:tab_min_count = get(g:, 'airline#extensions#tabline#tab_min_count', 0) |
||||||
|
|
||||||
|
function! airline#extensions#tabline#init(ext) |
||||||
|
if has('gui_running') |
||||||
|
set guioptions-=e |
||||||
|
endif |
||||||
|
|
||||||
|
set tabline=%!airline#extensions#tabline#get() |
||||||
|
|
||||||
|
if s:buf_min_count <= 0 && s:tab_min_count <= 1 |
||||||
|
set showtabline=2 |
||||||
|
else |
||||||
|
if s:show_buffers == 1 |
||||||
|
autocmd CursorMoved * call <sid>on_cursormove(s:buf_min_count, len(s:get_buffer_list())) |
||||||
|
else |
||||||
|
autocmd TabEnter * call <sid>on_cursormove(s:tab_min_count, tabpagenr('$')) |
||||||
|
endif |
||||||
|
endif |
||||||
|
|
||||||
|
call a:ext.add_theme_func('airline#extensions#tabline#load_theme') |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#tabline#load_theme(palette) |
||||||
|
let colors = get(a:palette, 'tabline', {}) |
||||||
|
let l:tab = get(colors, 'airline_tab', a:palette.normal.airline_b) |
||||||
|
let l:tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a) |
||||||
|
let l:tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a) |
||||||
|
let l:tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c) |
||||||
|
let l:tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a) |
||||||
|
let l:tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c) |
||||||
|
call airline#highlighter#exec('airline_tab', l:tab) |
||||||
|
call airline#highlighter#exec('airline_tabsel', l:tabsel) |
||||||
|
call airline#highlighter#exec('airline_tabtype', l:tabtype) |
||||||
|
call airline#highlighter#exec('airline_tabfill', l:tabfill) |
||||||
|
call airline#highlighter#exec('airline_tabmod', l:tabmod) |
||||||
|
call airline#highlighter#exec('airline_tabhid', l:tabhid) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:on_cursormove(min_count, total_count) |
||||||
|
if a:total_count >= a:min_count |
||||||
|
if &showtabline != 2 |
||||||
|
set showtabline=2 |
||||||
|
endif |
||||||
|
else |
||||||
|
if &showtabline != 0 |
||||||
|
set showtabline=0 |
||||||
|
endif |
||||||
|
endif |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#tabline#get() |
||||||
|
if s:show_buffers && tabpagenr('$') == 1 |
||||||
|
return s:get_buffers() |
||||||
|
else |
||||||
|
return s:get_tabs() |
||||||
|
endif |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#tabline#title(n) |
||||||
|
let buflist = tabpagebuflist(a:n) |
||||||
|
let winnr = tabpagewinnr(a:n) |
||||||
|
return airline#extensions#tabline#get_buffer_name(buflist[winnr - 1]) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#tabline#get_buffer_name(nr) |
||||||
|
return airline#extensions#tabline#formatters#{s:formatter}(a:nr, get(s:, 'current_buffer_list', [])) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:get_buffer_list() |
||||||
|
let buffers = [] |
||||||
|
let cur = bufnr('%') |
||||||
|
for nr in range(1, bufnr('$')) |
||||||
|
if buflisted(nr) && bufexists(nr) |
||||||
|
for ex in s:excludes |
||||||
|
if match(bufname(nr), ex) |
||||||
|
continue |
||||||
|
endif |
||||||
|
endfor |
||||||
|
if getbufvar(nr, 'current_syntax') == 'qf' |
||||||
|
continue |
||||||
|
endif |
||||||
|
call add(buffers, nr) |
||||||
|
endif |
||||||
|
endfor |
||||||
|
|
||||||
|
let s:current_buffer_list = buffers |
||||||
|
return buffers |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:get_visible_buffers() |
||||||
|
let buffers = s:get_buffer_list() |
||||||
|
let cur = bufnr('%') |
||||||
|
|
||||||
|
let total_width = 0 |
||||||
|
let max_width = 0 |
||||||
|
|
||||||
|
for nr in buffers |
||||||
|
let width = len(airline#extensions#tabline#get_buffer_name(nr)) + 4 |
||||||
|
let total_width += width |
||||||
|
let max_width = max([max_width, width]) |
||||||
|
endfor |
||||||
|
|
||||||
|
" only show current and surrounding buffers if there are too many buffers |
||||||
|
let position = index(buffers, cur) |
||||||
|
let vimwidth = &columns |
||||||
|
if total_width > vimwidth && position > -1 |
||||||
|
let buf_count = len(buffers) |
||||||
|
|
||||||
|
" determine how many buffers to show based on the longest buffer width, |
||||||
|
" use one on the right side and put the rest on the left |
||||||
|
let buf_max = vimwidth / max_width |
||||||
|
let buf_right = 1 |
||||||
|
let buf_left = max([0, buf_max - buf_right]) |
||||||
|
|
||||||
|
let start = max([0, position - buf_left]) |
||||||
|
let end = min([buf_count, position + buf_right]) |
||||||
|
|
||||||
|
" fill up available space on the right |
||||||
|
if position < buf_left |
||||||
|
let end += (buf_left - position) |
||||||
|
endif |
||||||
|
|
||||||
|
" fill up available space on the left |
||||||
|
if end > buf_count - 1 - buf_right |
||||||
|
let start -= max([0, buf_right - (buf_count - 1 - position)]) |
||||||
|
endif |
||||||
|
|
||||||
|
let buffers = eval('buffers[' . start . ':' . end . ']') |
||||||
|
|
||||||
|
if start > 0 |
||||||
|
call insert(buffers, -1, 0) |
||||||
|
endif |
||||||
|
|
||||||
|
if end < buf_count - 1 |
||||||
|
call add(buffers, -1) |
||||||
|
endif |
||||||
|
endif |
||||||
|
|
||||||
|
return buffers |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:get_buffers() |
||||||
|
let b = airline#builder#new(s:builder_context) |
||||||
|
let cur = bufnr('%') |
||||||
|
let tab_bufs = tabpagebuflist(tabpagenr()) |
||||||
|
for nr in s:get_visible_buffers() |
||||||
|
if nr < 0 |
||||||
|
call b.add_raw('%#airline_tabhid#...') |
||||||
|
continue |
||||||
|
endif |
||||||
|
if cur == nr |
||||||
|
if g:airline_detect_modified && getbufvar(nr, '&modified') |
||||||
|
let group = 'airline_tabmod' |
||||||
|
else |
||||||
|
let group = 'airline_tabsel' |
||||||
|
endif |
||||||
|
else |
||||||
|
if index(tab_bufs, nr) > -1 |
||||||
|
let group = 'airline_tab' |
||||||
|
else |
||||||
|
let group = 'airline_tabhid' |
||||||
|
endif |
||||||
|
endif |
||||||
|
call b.add_section(group, '%( %{airline#extensions#tabline#get_buffer_name('.nr.')} %)') |
||||||
|
endfor |
||||||
|
|
||||||
|
call b.add_section('airline_tabfill', '') |
||||||
|
call b.split() |
||||||
|
call b.add_section('airline_tabtype', ' buffers ') |
||||||
|
return b.build() |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:get_tabs() |
||||||
|
let b = airline#builder#new(s:builder_context) |
||||||
|
for i in range(1, tabpagenr('$')) |
||||||
|
if i == tabpagenr() |
||||||
|
let group = 'airline_tabsel' |
||||||
|
if g:airline_detect_modified |
||||||
|
for bi in tabpagebuflist(i) |
||||||
|
if getbufvar(bi, '&modified') |
||||||
|
let group = 'airline_tabmod' |
||||||
|
endif |
||||||
|
endfor |
||||||
|
endif |
||||||
|
else |
||||||
|
let group = 'airline_tab' |
||||||
|
endif |
||||||
|
let val = '%(' |
||||||
|
if s:tab_nr_type == 0 |
||||||
|
let val .= ' %{len(tabpagebuflist('.i.'))}' |
||||||
|
else |
||||||
|
let val .= (g:airline_symbols.space).i |
||||||
|
endif |
||||||
|
call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)') |
||||||
|
endfor |
||||||
|
call b.add_raw('%T') |
||||||
|
call b.add_section('airline_tabfill', '') |
||||||
|
call b.split() |
||||||
|
call b.add_section('airline_tab', ' %999XX ') |
||||||
|
call b.add_section('airline_tabtype', ' tabs ') |
||||||
|
return b.build() |
||||||
|
endfunction |
||||||
|
|
@ -0,0 +1,34 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.') |
||||||
|
let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1) |
||||||
|
let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ') |
||||||
|
let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0) |
||||||
|
let s:buf_modified_symbol = g:airline_symbols.modified |
||||||
|
|
||||||
|
function! airline#extensions#tabline#formatters#default(bufnr, buffers) |
||||||
|
let _ = '' |
||||||
|
|
||||||
|
if s:buf_nr_show |
||||||
|
let _ .= printf(s:buf_nr_format, a:bufnr) |
||||||
|
endif |
||||||
|
|
||||||
|
let name = bufname(a:bufnr) |
||||||
|
if empty(name) |
||||||
|
let _ .= '[No Name]' |
||||||
|
else |
||||||
|
if s:fnamecollapse |
||||||
|
let _ .= substitute(fnamemodify(name, s:fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g') |
||||||
|
else |
||||||
|
let _ .= fnamemodify(name, s:fmod) |
||||||
|
endif |
||||||
|
endif |
||||||
|
|
||||||
|
if getbufvar(a:bufnr, '&modified') == 1 |
||||||
|
let _ .= s:buf_modified_symbol |
||||||
|
endif |
||||||
|
|
||||||
|
return _ |
||||||
|
endfunction |
||||||
|
|
@ -1,14 +1,39 @@ |
|||||||
" MIT license. Copyright (c) 2013 Bailey Ling. |
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
" vim: ts=2 sts=2 sw=2 fdm=indent |
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
function! airline#extensions#tagbar#apply() |
if !exists(':TagbarToggle') |
||||||
let w:airline_section_x = '%(%{tagbar#currenttag("%s","")} '.g:airline_right_alt_sep.' %)'.g:airline_section_x |
finish |
||||||
if &ft == 'tagbar' |
endif |
||||||
call airline#extensions#apply_left_override('Tagbar', '%{TagbarGenerateStatusline()}') |
|
||||||
|
let s:flags = get(g:, 'airline#extensions#tagbar#flags', '') |
||||||
|
let s:spc = g:airline_symbols.space |
||||||
|
|
||||||
|
" Arguments: current, sort, fname |
||||||
|
function! airline#extensions#tagbar#get_status(...) |
||||||
|
let builder = airline#builder#new({ 'active': a:1 }) |
||||||
|
call builder.add_section('airline_a', s:spc.'Tagbar'.s:spc) |
||||||
|
call builder.add_section('airline_b', s:spc.a:2.s:spc) |
||||||
|
call builder.add_section('airline_c', s:spc.a:3.s:spc) |
||||||
|
return builder.build() |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#tagbar#inactive_apply(...) |
||||||
|
if getwinvar(a:2.winnr, '&filetype') == 'tagbar' |
||||||
|
return -1 |
||||||
endif |
endif |
||||||
endfunction |
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#tagbar#currenttag() |
||||||
|
if get(w:, 'airline_active', 0) |
||||||
|
return tagbar#currenttag('%s', '', s:flags) |
||||||
|
endif |
||||||
|
return '' |
||||||
|
endfunction |
||||||
|
|
||||||
function! airline#extensions#tagbar#init(ext) |
function! airline#extensions#tagbar#init(ext) |
||||||
call a:ext.add_statusline_funcref(function('airline#extensions#tagbar#apply')) |
call a:ext.add_inactive_statusline_func('airline#extensions#tagbar#inactive_apply') |
||||||
|
let g:tagbar_status_func = 'airline#extensions#tagbar#get_status' |
||||||
|
|
||||||
|
call airline#parts#define_function('tagbar', 'airline#extensions#tagbar#currenttag') |
||||||
endfunction |
endfunction |
||||||
|
|
||||||
|
@ -0,0 +1,27 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
if !exists(':UndotreeToggle') |
||||||
|
finish |
||||||
|
endif |
||||||
|
|
||||||
|
function! airline#extensions#undotree#apply(...) |
||||||
|
if exists('t:undotree') |
||||||
|
if &ft == 'undotree' |
||||||
|
if exists('*t:undotree.GetStatusLine') |
||||||
|
call airline#extensions#apply_left_override('undo', '%{t:undotree.GetStatusLine()}') |
||||||
|
else |
||||||
|
call airline#extensions#apply_left_override('undotree', '%f') |
||||||
|
endif |
||||||
|
endif |
||||||
|
|
||||||
|
if &ft == 'diff' && exists('*t:diffpanel.GetStatusLine') |
||||||
|
call airline#extensions#apply_left_override('diff', '%{t:diffpanel.GetStatusLine()}') |
||||||
|
endif |
||||||
|
endif |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#undotree#init(ext) |
||||||
|
call a:ext.add_statusline_func('airline#extensions#undotree#apply') |
||||||
|
endfunction |
||||||
|
|
@ -0,0 +1,23 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
if !get(g:, 'loaded_unite', 0) |
||||||
|
finish |
||||||
|
endif |
||||||
|
|
||||||
|
function! airline#extensions#unite#apply(...) |
||||||
|
if &ft == 'unite' |
||||||
|
call a:1.add_section('airline_a', ' Unite ') |
||||||
|
call a:1.add_section('airline_b', ' %{get(unite#get_context(), "buffer_name", "")} ') |
||||||
|
call a:1.add_section('airline_c', ' %{unite#get_status_string()} ') |
||||||
|
call a:1.split() |
||||||
|
call a:1.add_section('airline_y', ' %{get(unite#get_context(), "real_buffer_name", "")} ') |
||||||
|
return 1 |
||||||
|
endif |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#unite#init(ext) |
||||||
|
let g:unite_force_overwrite_statusline = 0 |
||||||
|
call a:ext.add_statusline_func('airline#extensions#unite#apply') |
||||||
|
endfunction |
||||||
|
|
@ -0,0 +1,20 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
if !get(g:, 'virtualenv_loaded', 0) |
||||||
|
finish |
||||||
|
endif |
||||||
|
|
||||||
|
let s:spc = g:airline_symbols.space |
||||||
|
|
||||||
|
function! airline#extensions#virtualenv#init(ext) |
||||||
|
call a:ext.add_statusline_func('airline#extensions#virtualenv#apply') |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#extensions#virtualenv#apply(...) |
||||||
|
if &filetype =~ "python" |
||||||
|
call airline#extensions#append_to_section('x', |
||||||
|
\ s:spc.g:airline_right_alt_sep.s:spc.'%{virtualenv#statusline()}') |
||||||
|
endif |
||||||
|
endfunction |
||||||
|
|
@ -0,0 +1,148 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
let s:is_win32term = (has('win32') || has('win64')) && !has('gui_running') |
||||||
|
let s:separators = {} |
||||||
|
|
||||||
|
function! s:gui2cui(rgb, fallback) |
||||||
|
if a:rgb == '' |
||||||
|
return a:fallback |
||||||
|
endif |
||||||
|
let rgb = map(matchlist(a:rgb, '#\(..\)\(..\)\(..\)')[1:3], '0 + ("0x".v:val)') |
||||||
|
let rgb = [rgb[0] > 127 ? 4 : 0, rgb[1] > 127 ? 2 : 0, rgb[2] > 127 ? 1 : 0] |
||||||
|
return rgb[0]+rgb[1]+rgb[2] |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:get_syn(group, what) |
||||||
|
" need to pass in mode, known to break on 7.3.547 |
||||||
|
let mode = has('gui_running') ? 'gui' : 'cterm' |
||||||
|
let color = synIDattr(synIDtrans(hlID(a:group)), a:what, mode) |
||||||
|
if empty(color) || color == -1 |
||||||
|
let color = synIDattr(synIDtrans(hlID('Normal')), a:what, mode) |
||||||
|
endif |
||||||
|
if empty(color) || color == -1 |
||||||
|
if has('gui_running') |
||||||
|
let color = a:what ==# 'fg' ? '#000000' : '#FFFFFF' |
||||||
|
else |
||||||
|
let color = a:what ==# 'fg' ? 0 : 1 |
||||||
|
endif |
||||||
|
endif |
||||||
|
return color |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:get_array(fg, bg, opts) |
||||||
|
let fg = a:fg |
||||||
|
let bg = a:bg |
||||||
|
return has('gui_running') |
||||||
|
\ ? [ fg, bg, '', '', join(a:opts, ',') ] |
||||||
|
\ : [ '', '', fg, bg, join(a:opts, ',') ] |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#highlighter#get_highlight(group, ...) |
||||||
|
let fg = s:get_syn(a:group, 'fg') |
||||||
|
let bg = s:get_syn(a:group, 'bg') |
||||||
|
let reverse = synIDattr(synIDtrans(hlID(a:group)), 'reverse', has('gui_running') ? 'gui' : 'term') |
||||||
|
return reverse ? s:get_array(bg, fg, a:000) : s:get_array(fg, bg, a:000) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#highlighter#get_highlight2(fg, bg, ...) |
||||||
|
let fg = s:get_syn(a:fg[0], a:fg[1]) |
||||||
|
let bg = s:get_syn(a:bg[0], a:bg[1]) |
||||||
|
return s:get_array(fg, bg, a:000) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#highlighter#exec(group, colors) |
||||||
|
let colors = a:colors |
||||||
|
if s:is_win32term |
||||||
|
let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, '')) |
||||||
|
let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, '')) |
||||||
|
endif |
||||||
|
exec printf('hi %s %s %s %s %s %s %s %s', |
||||||
|
\ a:group, |
||||||
|
\ get(colors, 0, '') != '' ? 'guifg='.colors[0] : '', |
||||||
|
\ get(colors, 1, '') != '' ? 'guibg='.colors[1] : '', |
||||||
|
\ get(colors, 2, '') != '' ? 'ctermfg='.colors[2] : '', |
||||||
|
\ get(colors, 3, '') != '' ? 'ctermbg='.colors[3] : '', |
||||||
|
\ get(colors, 4, '') != '' ? 'gui='.colors[4] : '', |
||||||
|
\ get(colors, 4, '') != '' ? 'cterm='.colors[4] : '', |
||||||
|
\ get(colors, 4, '') != '' ? 'term='.colors[4] : '') |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:exec_separator(dict, from, to, inverse, suffix) |
||||||
|
let l:from = airline#themes#get_highlight(a:from.a:suffix) |
||||||
|
let l:to = airline#themes#get_highlight(a:to.a:suffix) |
||||||
|
let group = a:from.'_to_'.a:to.a:suffix |
||||||
|
if a:inverse |
||||||
|
let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ] |
||||||
|
else |
||||||
|
let colors = [ l:to[1], l:from[1], l:to[3], l:from[3] ] |
||||||
|
endif |
||||||
|
let a:dict[group] = colors |
||||||
|
call airline#highlighter#exec(group, colors) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#highlighter#load_theme() |
||||||
|
for winnr in filter(range(1, winnr('$')), 'v:val != winnr()') |
||||||
|
call airline#highlighter#highlight_modified_inactive(winbufnr(winnr)) |
||||||
|
endfor |
||||||
|
call airline#highlighter#highlight(['inactive']) |
||||||
|
call airline#highlighter#highlight(['normal']) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#highlighter#add_separator(from, to, inverse) |
||||||
|
let s:separators[a:from.a:to] = [a:from, a:to, a:inverse] |
||||||
|
call <sid>exec_separator({}, a:from, a:to, a:inverse, '') |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#highlighter#highlight_modified_inactive(bufnr) |
||||||
|
if getbufvar(a:bufnr, '&modified') |
||||||
|
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c') |
||||||
|
\ ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : [] |
||||||
|
else |
||||||
|
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c') |
||||||
|
\ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : [] |
||||||
|
endif |
||||||
|
|
||||||
|
if !empty(colors) |
||||||
|
call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors) |
||||||
|
endif |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#highlighter#highlight(modes) |
||||||
|
let p = g:airline#themes#{g:airline_theme}#palette |
||||||
|
|
||||||
|
" draw the base mode, followed by any overrides |
||||||
|
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val') |
||||||
|
let suffix = a:modes[0] == 'inactive' ? '_inactive' : '' |
||||||
|
for mode in mapped |
||||||
|
if exists('g:airline#themes#{g:airline_theme}#palette[mode]') |
||||||
|
let dict = g:airline#themes#{g:airline_theme}#palette[mode] |
||||||
|
for kvp in items(dict) |
||||||
|
let mode_colors = kvp[1] |
||||||
|
call airline#highlighter#exec(kvp[0].suffix, mode_colors) |
||||||
|
|
||||||
|
for accent in keys(p.accents) |
||||||
|
let colors = copy(mode_colors) |
||||||
|
if p.accents[accent][0] != '' |
||||||
|
let colors[0] = p.accents[accent][0] |
||||||
|
endif |
||||||
|
if p.accents[accent][2] != '' |
||||||
|
let colors[2] = p.accents[accent][2] |
||||||
|
endif |
||||||
|
if len(colors) >= 5 |
||||||
|
let colors[4] = get(p.accents[accent], 4, '') |
||||||
|
else |
||||||
|
call add(colors, get(p.accents[accent], 4, '')) |
||||||
|
endif |
||||||
|
call airline#highlighter#exec(kvp[0].suffix.'_'.accent, colors) |
||||||
|
endfor |
||||||
|
endfor |
||||||
|
|
||||||
|
" TODO: optimize this |
||||||
|
for sep in items(s:separators) |
||||||
|
call <sid>exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix) |
||||||
|
endfor |
||||||
|
endif |
||||||
|
endfor |
||||||
|
endfunction |
||||||
|
|
@ -0,0 +1,79 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
let s:parts = {} |
||||||
|
|
||||||
|
" PUBLIC API {{{ |
||||||
|
|
||||||
|
function! airline#parts#define(key, config) |
||||||
|
let s:parts[a:key] = get(s:parts, a:key, {}) |
||||||
|
if exists('g:airline#init#bootstrapping') |
||||||
|
call extend(s:parts[a:key], a:config, 'keep') |
||||||
|
else |
||||||
|
call extend(s:parts[a:key], a:config, 'force') |
||||||
|
endif |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#parts#define_function(key, name) |
||||||
|
call airline#parts#define(a:key, { 'function': a:name }) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#parts#define_text(key, text) |
||||||
|
call airline#parts#define(a:key, { 'text': a:text }) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#parts#define_raw(key, raw) |
||||||
|
call airline#parts#define(a:key, { 'raw': a:raw }) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#parts#define_minwidth(key, width) |
||||||
|
call airline#parts#define(a:key, { 'minwidth': a:width }) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#parts#define_condition(key, predicate) |
||||||
|
call airline#parts#define(a:key, { 'condition': a:predicate }) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#parts#define_accent(key, accent) |
||||||
|
call airline#parts#define(a:key, { 'accent': a:accent }) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#parts#define_empty(keys) |
||||||
|
for key in a:keys |
||||||
|
call airline#parts#define_raw(key, '') |
||||||
|
endfor |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#parts#get(key) |
||||||
|
return get(s:parts, a:key, {}) |
||||||
|
endfunction |
||||||
|
|
||||||
|
" }}} |
||||||
|
|
||||||
|
function! airline#parts#mode() |
||||||
|
return get(w:, 'airline_current_mode', '') |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#parts#paste() |
||||||
|
return g:airline_detect_paste && &paste ? g:airline_symbols.paste : '' |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#parts#iminsert() |
||||||
|
if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name') |
||||||
|
return toupper(b:keymap_name) |
||||||
|
endif |
||||||
|
return '' |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#parts#readonly() |
||||||
|
return &readonly ? g:airline_symbols.readonly : '' |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#parts#filetype() |
||||||
|
return &filetype |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#parts#ffenc() |
||||||
|
return printf('%s%s', &fenc, strlen(&ff) > 0 ? '['.&ff.']' : '') |
||||||
|
endfunction |
||||||
|
|
@ -0,0 +1,72 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
call airline#init#bootstrap() |
||||||
|
let s:spc = g:airline_symbols.space |
||||||
|
|
||||||
|
function! s:wrap_accent(part, value) |
||||||
|
if exists('a:part.accent') |
||||||
|
return '%#__accent_'.(a:part.accent).'#'.a:value.'%#__restore__#' |
||||||
|
endif |
||||||
|
return a:value |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! s:create(parts, append) |
||||||
|
let _ = '' |
||||||
|
for idx in range(len(a:parts)) |
||||||
|
let part = airline#parts#get(a:parts[idx]) |
||||||
|
let val = '' |
||||||
|
|
||||||
|
if exists('part.function') |
||||||
|
let func = (part.function).'()' |
||||||
|
elseif exists('part.text') |
||||||
|
let func = '"'.(part.text).'"' |
||||||
|
else |
||||||
|
if a:append > 0 && idx != 0 |
||||||
|
let val .= s:spc.g:airline_left_alt_sep.s:spc |
||||||
|
endif |
||||||
|
if a:append < 0 && idx != 0 |
||||||
|
let val = s:spc.g:airline_right_alt_sep.s:spc.val |
||||||
|
endif |
||||||
|
if exists('part.raw') |
||||||
|
let _ .= s:wrap_accent(part, val.(part.raw)) |
||||||
|
continue |
||||||
|
else |
||||||
|
let _ .= s:wrap_accent(part, val.a:parts[idx]) |
||||||
|
continue |
||||||
|
endif |
||||||
|
endif |
||||||
|
|
||||||
|
let minwidth = get(part, 'minwidth', 0) |
||||||
|
|
||||||
|
if a:append > 0 && idx != 0 |
||||||
|
let partval = printf('%%{airline#util#append(%s,%s)}', func, minwidth) |
||||||
|
elseif a:append < 0 && idx != len(a:parts) - 1 |
||||||
|
let partval = printf('%%{airline#util#prepend(%s,%s)}', func, minwidth) |
||||||
|
else |
||||||
|
let partval = printf('%%{airline#util#wrap(%s,%s)}', func, minwidth) |
||||||
|
endif |
||||||
|
|
||||||
|
if exists('part.condition') |
||||||
|
let partval = substitute(partval, '{', '{'.(part.condition).' ? ', '') |
||||||
|
let partval = substitute(partval, '}', ' : ""}', '') |
||||||
|
endif |
||||||
|
|
||||||
|
let val .= s:wrap_accent(part, partval) |
||||||
|
let _ .= val |
||||||
|
endfor |
||||||
|
return _ |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#section#create(parts) |
||||||
|
return s:create(a:parts, 0) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#section#create_left(parts) |
||||||
|
return s:create(a:parts, 1) |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#section#create_right(parts) |
||||||
|
return s:create(a:parts, -1) |
||||||
|
endfunction |
||||||
|
|
@ -1,46 +1,67 @@ |
|||||||
" MIT license. Copyright (c) 2013 Bailey Ling. |
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
" vim: ts=2 sts=2 sw=2 fdm=indent |
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
" generates a dictionary which defines the colors for each highlight group |
" generates a dictionary which defines the colors for each highlight group |
||||||
function! airline#themes#generate_color_map(section1, section2, section3, file) |
function! airline#themes#generate_color_map(sect1, sect2, sect3, ...) |
||||||
" guifg guibg ctermfg ctermbg gui/term |
let palette = { |
||||||
return { |
\ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '') ] , |
||||||
\ 'mode': [ a:section1[0] , a:section1[1] , a:section1[2] , a:section1[3] , get(a:section1, 4, 'bold') ] , |
\ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '') ] , |
||||||
\ 'mode_separator': [ a:section1[1] , a:section2[1] , a:section1[3] , a:section2[3] , '' ] , |
\ 'airline_c': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '') ] , |
||||||
\ 'info': [ a:section2[0] , a:section2[1] , a:section2[2] , a:section2[3] , get(a:section2, 4, '' ) ] , |
\ } |
||||||
\ 'info_separator': [ a:section2[1] , a:section3[1] , a:section2[3] , a:section3[3] , '' ] , |
|
||||||
\ 'statusline': [ a:section3[0] , a:section3[1] , a:section3[2] , a:section3[3] , get(a:section3, 4, '' ) ] , |
|
||||||
\ 'file': [ a:file[0] , a:file[1] , a:file[2] , a:file[3] , get(a:file , 4, '' ) ] , |
|
||||||
\ } |
|
||||||
endfunction |
|
||||||
|
|
||||||
function! s:get_syn(group, what) |
if a:0 > 0 |
||||||
let color = synIDattr(synIDtrans(hlID(a:group)), a:what) |
call extend(palette, { |
||||||
if empty(color) || color == -1 |
\ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] , |
||||||
let color = synIDattr(synIDtrans(hlID('Normal')), a:what) |
\ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] , |
||||||
endif |
\ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] , |
||||||
if empty(color) || color == -1 |
\ }) |
||||||
let color = a:what ==# 'fg' ? 0 : 1 |
else |
||||||
|
call extend(palette, { |
||||||
|
\ 'airline_x': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , '' ] , |
||||||
|
\ 'airline_y': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , '' ] , |
||||||
|
\ 'airline_z': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , '' ] , |
||||||
|
\ }) |
||||||
endif |
endif |
||||||
return color |
|
||||||
endfunction |
|
||||||
|
|
||||||
function! s:get_array(fg, bg, opts) |
return palette |
||||||
let fg = a:fg |
|
||||||
let bg = a:bg |
|
||||||
return has('gui_running') |
|
||||||
\ ? [ fg, bg, '', '', join(a:opts, ',') ] |
|
||||||
\ : [ '', '', fg, bg, join(a:opts, ',') ] |
|
||||||
endfunction |
endfunction |
||||||
|
|
||||||
function! airline#themes#get_highlight(group, ...) |
function! airline#themes#get_highlight(group, ...) |
||||||
let fg = s:get_syn(a:group, 'fg') |
return call('airline#highlighter#get_highlight', [a:group] + a:000) |
||||||
let bg = s:get_syn(a:group, 'bg') |
|
||||||
return s:get_array(fg, bg, a:000) |
|
||||||
endfunction |
endfunction |
||||||
|
|
||||||
function! airline#themes#get_highlight2(fg, bg, ...) |
function! airline#themes#get_highlight2(fg, bg, ...) |
||||||
let fg = s:get_syn(a:fg[0], a:fg[1]) |
return call('airline#highlighter#get_highlight2', [a:fg, a:bg] + a:000) |
||||||
let bg = s:get_syn(a:bg[0], a:bg[1]) |
endfunction |
||||||
return s:get_array(fg, bg, a:000) |
|
||||||
|
function! airline#themes#patch(palette) |
||||||
|
for mode in keys(a:palette) |
||||||
|
if !has_key(a:palette[mode], 'airline_warning') |
||||||
|
let a:palette[mode]['airline_warning'] = [ '#000000', '#df5f00', 232, 166 ] |
||||||
|
endif |
||||||
|
endfor |
||||||
|
|
||||||
|
let a:palette.accents = get(a:palette, 'accents', {}) |
||||||
|
let a:palette.accents.bold = [ '', '', '', '', 'bold' ] |
||||||
|
let a:palette.accents.italic = [ '', '', '', '', 'italic' ] |
||||||
|
|
||||||
|
if !has_key(a:palette.accents, 'red') |
||||||
|
let a:palette.accents.red = [ '#ff0000' , '' , 160 , '' ] |
||||||
|
endif |
||||||
|
if !has_key(a:palette.accents, 'green') |
||||||
|
let a:palette.accents.green = [ '#008700' , '' , 22 , '' ] |
||||||
|
endif |
||||||
|
if !has_key(a:palette.accents, 'blue') |
||||||
|
let a:palette.accents.blue = [ '#005fff' , '' , 27 , '' ] |
||||||
|
endif |
||||||
|
if !has_key(a:palette.accents, 'yellow') |
||||||
|
let a:palette.accents.yellow = [ '#dfff00' , '' , 190 , '' ] |
||||||
|
endif |
||||||
|
if !has_key(a:palette.accents, 'orange') |
||||||
|
let a:palette.accents.orange = [ '#df5f00' , '' , 166 , '' ] |
||||||
|
endif |
||||||
|
if !has_key(a:palette.accents, 'purple') |
||||||
|
let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ] |
||||||
|
endif |
||||||
endfunction |
endfunction |
||||||
|
|
||||||
|
@ -0,0 +1,107 @@ |
|||||||
|
if get(g:, 'airline#themes#base16#constant', 0) |
||||||
|
let g:airline#themes#base16#palette = {} |
||||||
|
|
||||||
|
" Color palette |
||||||
|
let s:gui_dark_gray = '#202020' |
||||||
|
let s:cterm_dark_gray = 234 |
||||||
|
let s:gui_med_gray_hi = '#303030' |
||||||
|
let s:cterm_med_gray_hi = 236 |
||||||
|
let s:gui_med_gray_lo = '#3a3a3a' |
||||||
|
let s:cterm_med_gray_lo = 237 |
||||||
|
let s:gui_light_gray = '#505050' |
||||||
|
let s:cterm_light_gray = 239 |
||||||
|
let s:gui_green = '#99cc99' |
||||||
|
let s:cterm_green = 151 |
||||||
|
let s:gui_blue = '#6a9fb5' |
||||||
|
let s:cterm_blue = 67 |
||||||
|
let s:gui_purple = '#aa759f' |
||||||
|
let s:cterm_purple = 139 |
||||||
|
let s:gui_orange = '#d28445' |
||||||
|
let s:cterm_orange = 173 |
||||||
|
let s:gui_red = '#ac4142' |
||||||
|
let s:cterm_red = 131 |
||||||
|
let s:gui_pink = '#d7afd7' |
||||||
|
let s:cterm_pink = 182 |
||||||
|
|
||||||
|
" Normal mode |
||||||
|
let s:N1 = [s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green] |
||||||
|
let s:N2 = [s:gui_light_gray, s:gui_med_gray_lo, s:cterm_light_gray, s:cterm_med_gray_lo] |
||||||
|
let s:N3 = [s:gui_green, s:gui_med_gray_hi, s:cterm_green, s:cterm_med_gray_hi] |
||||||
|
let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
||||||
|
let g:airline#themes#base16#palette.normal_modified = { |
||||||
|
\ 'airline_c': [s:gui_orange, s:gui_med_gray_hi, s:cterm_orange, s:cterm_med_gray_hi, ''], |
||||||
|
\ } |
||||||
|
|
||||||
|
" Insert mode |
||||||
|
let s:I1 = [s:gui_med_gray_hi, s:gui_blue, s:cterm_med_gray_hi, s:cterm_blue] |
||||||
|
let s:I3 = [s:gui_blue, s:gui_med_gray_hi, s:cterm_blue, s:cterm_med_gray_hi] |
||||||
|
let g:airline#themes#base16#palette.insert = airline#themes#generate_color_map(s:I1, s:N2, s:I3) |
||||||
|
let g:airline#themes#base16#palette.insert_modified = copy(g:airline#themes#base16#palette.normal_modified) |
||||||
|
let g:airline#themes#base16#palette.insert_paste = { |
||||||
|
\ 'airline_a': [s:gui_dark_gray, s:gui_orange, s:cterm_dark_gray, s:cterm_orange, ''], |
||||||
|
\ } |
||||||
|
|
||||||
|
" Replace mode |
||||||
|
let g:airline#themes#base16#palette.replace = { |
||||||
|
\ 'airline_a': [s:gui_dark_gray, s:gui_red, s:cterm_dark_gray, s:cterm_red, ''], |
||||||
|
\ 'airline_c': [s:gui_red, s:gui_med_gray_hi, s:cterm_red, s:cterm_med_gray_hi, ''], |
||||||
|
\ } |
||||||
|
let g:airline#themes#base16#palette.replace_modified = copy(g:airline#themes#base16#palette.insert_modified) |
||||||
|
|
||||||
|
" Visual mode |
||||||
|
let s:V1 = [s:gui_dark_gray, s:gui_pink, s:cterm_dark_gray, s:cterm_pink] |
||||||
|
let s:V3 = [s:gui_pink, s:gui_med_gray_hi, s:cterm_pink, s:cterm_med_gray_hi] |
||||||
|
let g:airline#themes#base16#palette.visual = airline#themes#generate_color_map(s:V1, s:N2, s:V3) |
||||||
|
let g:airline#themes#base16#palette.visual_modified = copy(g:airline#themes#base16#palette.insert_modified) |
||||||
|
|
||||||
|
" Inactive window |
||||||
|
let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_dark_gray, s:cterm_med_gray_hi, ''] |
||||||
|
let g:airline#themes#base16#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) |
||||||
|
let g:airline#themes#base16#palette.inactive_modified = { |
||||||
|
\ 'airline_c': [s:gui_orange, '', s:cterm_orange, '', ''], |
||||||
|
\ } |
||||||
|
else |
||||||
|
function! airline#themes#base16#refresh() |
||||||
|
let g:airline#themes#base16#palette = {} |
||||||
|
|
||||||
|
let g:airline#themes#base16#palette.accents = { |
||||||
|
\ 'red': airline#themes#get_highlight('Constant'), |
||||||
|
\ } |
||||||
|
|
||||||
|
let s:N1 = airline#themes#get_highlight2(['DiffText', 'bg'], ['DiffText', 'fg'], 'bold') |
||||||
|
let s:N2 = airline#themes#get_highlight('Visual') |
||||||
|
let s:N3 = airline#themes#get_highlight('CursorLine') |
||||||
|
let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
||||||
|
|
||||||
|
let group = airline#themes#get_highlight('vimCommand') |
||||||
|
let g:airline#themes#base16#palette.normal_modified = { |
||||||
|
\ 'statusline': [ group[0], '', group[2], '', '' ] |
||||||
|
\ } |
||||||
|
|
||||||
|
let s:I1 = airline#themes#get_highlight2(['DiffAdded', 'bg'], ['DiffAdded', 'fg'], 'bold') |
||||||
|
let s:I2 = airline#themes#get_highlight2(['DiffAdded', 'fg'], ['Normal', 'bg']) |
||||||
|
let s:I3 = s:N3 |
||||||
|
let g:airline#themes#base16#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) |
||||||
|
let g:airline#themes#base16#palette.insert_modified = g:airline#themes#base16#palette.normal_modified |
||||||
|
|
||||||
|
let s:R1 = airline#themes#get_highlight2(['WarningMsg', 'bg'], ['WarningMsg', 'fg'], 'bold') |
||||||
|
let s:R2 = s:N2 |
||||||
|
let s:R3 = s:N3 |
||||||
|
let g:airline#themes#base16#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) |
||||||
|
let g:airline#themes#base16#palette.replace_modified = g:airline#themes#base16#palette.normal_modified |
||||||
|
|
||||||
|
let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Constant', 'fg'], 'bold') |
||||||
|
let s:V2 = airline#themes#get_highlight2(['Constant', 'fg'], ['Normal', 'bg']) |
||||||
|
let s:V3 = s:N3 |
||||||
|
let g:airline#themes#base16#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) |
||||||
|
let g:airline#themes#base16#palette.visual_modified = g:airline#themes#base16#palette.normal_modified |
||||||
|
|
||||||
|
let s:IA = airline#themes#get_highlight2(['NonText', 'fg'], ['CursorLine', 'bg']) |
||||||
|
let g:airline#themes#base16#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) |
||||||
|
let g:airline#themes#base16#palette.inactive_modified = { |
||||||
|
\ 'airline_c': [ group[0], '', group[2], '', '' ] |
||||||
|
\ } |
||||||
|
endfunction |
||||||
|
call airline#themes#base16#refresh() |
||||||
|
endif |
||||||
|
|
@ -1,47 +1,45 @@ |
|||||||
let s:file = [ '#df0000' , '#ffffff' , 160 , 255 ] |
let g:airline#themes#light#palette = {} |
||||||
|
|
||||||
let s:N1 = [ '#ffffff' , '#005fff' , 255 , 27 ] |
let s:N1 = [ '#ffffff' , '#005fff' , 255 , 27 ] |
||||||
let s:N2 = [ '#000087' , '#00dfff' , 18 , 45 ] |
let s:N2 = [ '#000087' , '#00dfff' , 18 , 45 ] |
||||||
let s:N3 = [ '#005fff' , '#afffff' , 27 , 159 ] |
let s:N3 = [ '#005fff' , '#afffff' , 27 , 159 ] |
||||||
let g:airline#themes#light#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) |
let g:airline#themes#light#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
||||||
let g:airline#themes#light#normal_modified = { |
let g:airline#themes#light#palette.normal_modified = { |
||||||
\ 'info_separator': [ '#00dfff' , '#ffdfdf' , 45 , 224 , '' ] , |
\ 'airline_c': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , |
||||||
\ 'statusline': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , |
|
||||||
\ } |
\ } |
||||||
|
|
||||||
|
|
||||||
let s:I1 = [ '#ffffff' , '#00875f' , 255 , 29 ] |
let s:I1 = [ '#ffffff' , '#00875f' , 255 , 29 ] |
||||||
let s:I2 = [ '#005f00' , '#00df87' , 22 , 42 ] |
let s:I2 = [ '#005f00' , '#00df87' , 22 , 42 ] |
||||||
let s:I3 = [ '#005f5f' , '#afff87' , 23 , 156 ] |
let s:I3 = [ '#005f5f' , '#afff87' , 23 , 156 ] |
||||||
let g:airline#themes#light#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) |
let g:airline#themes#light#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) |
||||||
let g:airline#themes#light#insert_modified = { |
let g:airline#themes#light#palette.insert_modified = { |
||||||
\ 'info_separator': [ '#00df87' , '#ffdfdf' , 42 , 224 , '' ] , |
\ 'airline_c': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , |
||||||
\ 'statusline': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , |
|
||||||
\ } |
\ } |
||||||
let g:airline#themes#light#insert_paste = { |
let g:airline#themes#light#palette.insert_paste = { |
||||||
\ 'mode': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] , |
\ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] , |
||||||
\ 'mode_separator': [ '#d78700' , s:I2[1] , 172 , s:I2[3] , '' ] , |
|
||||||
\ } |
\ } |
||||||
|
|
||||||
|
|
||||||
let g:airline#themes#light#replace = copy(g:airline#themes#light#insert) |
let g:airline#themes#light#palette.replace = copy(g:airline#themes#light#palette.insert) |
||||||
let g:airline#themes#light#replace.mode = [ s:I2[0] , '#ff0000' , s:I1[2] , 196 , '' ] |
let g:airline#themes#light#palette.replace.airline_a = [ 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#palette.replace_modified = g:airline#themes#light#palette.insert_modified |
||||||
let g:airline#themes#light#replace_modified = g:airline#themes#light#insert_modified |
|
||||||
|
|
||||||
|
|
||||||
let s:V1 = [ '#ffffff' , '#ff5f00' , 255 , 202 ] |
let s:V1 = [ '#ffffff' , '#ff5f00' , 255 , 202 ] |
||||||
let s:V2 = [ '#5f0000' , '#ffaf00' , 52 , 214 ] |
let s:V2 = [ '#5f0000' , '#ffaf00' , 52 , 214 ] |
||||||
let s:V3 = [ '#df5f00' , '#ffff87' , 166 , 228 ] |
let s:V3 = [ '#df5f00' , '#ffff87' , 166 , 228 ] |
||||||
let g:airline#themes#light#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) |
let g:airline#themes#light#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) |
||||||
let g:airline#themes#light#visual_modified = { |
let g:airline#themes#light#palette.visual_modified = { |
||||||
\ 'info_separator': [ '#ffaf00' , '#ffdfdf' , 214 , 224 , '' ] , |
\ 'airline_c': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , |
||||||
\ 'statusline': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] , |
|
||||||
\ } |
\ } |
||||||
|
|
||||||
|
|
||||||
let s:IA = [ '#9e9e9e' , '#ffffff' , 247 , 255 , '' ] |
let s:IA1 = [ '#666666' , '#b2b2b2' , 242 , 249 , '' ] |
||||||
let g:airline#themes#light#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) |
let s:IA2 = [ '#8a8a8a' , '#d0d0d0' , 245 , 252 , '' ] |
||||||
let g:airline#themes#light#inactive_modified = { |
let s:IA3 = [ '#a8a8a8' , '#ffffff' , 248 , 255 , '' ] |
||||||
\ 'statusline': [ '#df0000' , '' , '160' , '', '' ] |
let g:airline#themes#light#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) |
||||||
|
let g:airline#themes#light#palette.inactive_modified = { |
||||||
|
\ 'airline_c': [ '#df0000' , '' , 160 , '' , '' ] , |
||||||
\ } |
\ } |
||||||
|
|
||||||
|
@ -0,0 +1,56 @@ |
|||||||
|
let g:airline#themes#lucius#palette = {} |
||||||
|
|
||||||
|
function! airline#themes#lucius#refresh() |
||||||
|
|
||||||
|
let s:N1 = airline#themes#get_highlight('StatusLine') |
||||||
|
let s:N2 = airline#themes#get_highlight('Folded') |
||||||
|
let s:N3 = airline#themes#get_highlight('CursorLine') |
||||||
|
let g:airline#themes#lucius#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
||||||
|
|
||||||
|
let modified_group = airline#themes#get_highlight('Statement') |
||||||
|
let g:airline#themes#lucius#palette.normal_modified = { |
||||||
|
\ 'airline_c': [modified_group[0], '', modified_group[2], '', ''] |
||||||
|
\ } |
||||||
|
|
||||||
|
let warning_group = airline#themes#get_highlight('DiffDelete') |
||||||
|
let g:airline#themes#lucius#palette.normal.airline_warning = warning_group |
||||||
|
let g:airline#themes#lucius#palette.normal_modified.airline_warning = warning_group |
||||||
|
|
||||||
|
let s:I1 = airline#themes#get_highlight('DiffAdd') |
||||||
|
let s:I2 = s:N2 |
||||||
|
let s:I3 = s:N3 |
||||||
|
let g:airline#themes#lucius#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) |
||||||
|
let g:airline#themes#lucius#palette.insert_modified = g:airline#themes#lucius#palette.normal_modified |
||||||
|
let g:airline#themes#lucius#palette.insert.airline_warning = g:airline#themes#lucius#palette.normal.airline_warning |
||||||
|
let g:airline#themes#lucius#palette.insert_modified.airline_warning = g:airline#themes#lucius#palette.normal_modified.airline_warning |
||||||
|
|
||||||
|
let s:R1 = airline#themes#get_highlight('DiffChange') |
||||||
|
let s:R2 = s:N2 |
||||||
|
let s:R3 = s:N3 |
||||||
|
let g:airline#themes#lucius#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) |
||||||
|
let g:airline#themes#lucius#palette.replace_modified = g:airline#themes#lucius#palette.normal_modified |
||||||
|
let g:airline#themes#lucius#palette.replace.airline_warning = g:airline#themes#lucius#palette.normal.airline_warning |
||||||
|
let g:airline#themes#lucius#palette.replace_modified.airline_warning = g:airline#themes#lucius#palette.normal_modified.airline_warning |
||||||
|
|
||||||
|
let s:V1 = airline#themes#get_highlight('Cursor') |
||||||
|
let s:V2 = s:N2 |
||||||
|
let s:V3 = s:N3 |
||||||
|
let g:airline#themes#lucius#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) |
||||||
|
let g:airline#themes#lucius#palette.visual_modified = g:airline#themes#lucius#palette.normal_modified |
||||||
|
let g:airline#themes#lucius#palette.visual.airline_warning = g:airline#themes#lucius#palette.normal.airline_warning |
||||||
|
let g:airline#themes#lucius#palette.visual_modified.airline_warning = g:airline#themes#lucius#palette.normal_modified.airline_warning |
||||||
|
|
||||||
|
let s:IA = airline#themes#get_highlight('StatusLineNC') |
||||||
|
let g:airline#themes#lucius#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) |
||||||
|
let g:airline#themes#lucius#palette.inactive_modified = { |
||||||
|
\ 'airline_c': [ modified_group[0], '', modified_group[2], '', '' ] |
||||||
|
\ } |
||||||
|
|
||||||
|
let g:airline#themes#lucius#palette.accents = { |
||||||
|
\ 'red': airline#themes#get_highlight('Constant'), |
||||||
|
\ } |
||||||
|
|
||||||
|
endfunction |
||||||
|
|
||||||
|
call airline#themes#lucius#refresh() |
||||||
|
|
@ -1,56 +1,92 @@ |
|||||||
" vim-airline companion theme of Luna |
" vim-airline companion theme of Luna |
||||||
" (https://github.com/Pychimp/vim-luna) |
" (https://github.com/Pychimp/vim-luna) |
||||||
|
|
||||||
let s:file = [ '#ffffff' , '#002b2b' , 231 , 23 , '' ] |
let g:airline#themes#luna#palette = {} |
||||||
let s:N1 = [ '#ffffff' , '#005252' , 231 , 36 ] |
|
||||||
let s:N2 = [ '#ffffff' , '#003f3f' , 231 , 29 ] |
let g:airline#themes#luna#palette.accents = { |
||||||
let s:N3 = [ '#ffffff' , '#002b2b' , 231 , 23 ] |
\ 'red': [ '#ffffff' , '' , 231 , '' , '' ], |
||||||
|
\ } |
||||||
|
|
||||||
let g:airline#themes#luna#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) |
|
||||||
|
|
||||||
let g:airline#themes#luna#normal_modified = { |
let s:N1 = [ '#ffffff' , '#005252' , 231 , 36 ] |
||||||
\ 'info_separator': [ '#003f3f' , '#450000' , 29 , 52 , '' ] , |
let s:N2 = [ '#ffffff' , '#003f3f' , 231 , 29 ] |
||||||
\ 'statusline': [ '#ffffff' , '#450000' , 231 , 52 , '' ] , |
let s:N3 = [ '#ffffff' , '#002b2b' , 231 , 23 ] |
||||||
|
let g:airline#themes#luna#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
||||||
|
let g:airline#themes#luna#palette.normal_modified = { |
||||||
|
\ 'airline_c': [ '#ffffff' , '#450000' , 231 , 52 , '' ] , |
||||||
\ } |
\ } |
||||||
|
|
||||||
|
|
||||||
let s:I1 = [ '#ffffff' , '#789f00' , 231 , 106 ] |
let s:I1 = [ '#ffffff' , '#789f00' , 231 , 106 ] |
||||||
let s:I2 = [ '#ffffff' , '#003f3f' , 231 , 29 ] |
let s:I2 = [ '#ffffff' , '#003f3f' , 231 , 29 ] |
||||||
let s:I3 = [ '#ffffff' , '#002b2b' , 231 , 23 ] |
let s:I3 = [ '#ffffff' , '#002b2b' , 231 , 23 ] |
||||||
let g:airline#themes#luna#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) |
let g:airline#themes#luna#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) |
||||||
let g:airline#themes#luna#insert_modified = { |
let g:airline#themes#luna#palette.insert_modified = { |
||||||
\ 'info_separator': [ '#003f3f' , '#005e5e' , 29 , 52 , '' ] , |
\ 'airline_c': [ '#ffffff' , '#005e5e' , 255 , 52 , '' ] , |
||||||
\ 'statusline': [ '#ffffff' , '#005e5e' , 255 , 52 , '' ] , |
|
||||||
\ } |
\ } |
||||||
let g:airline#themes#luna#insert_paste = { |
let g:airline#themes#luna#palette.insert_paste = { |
||||||
\ 'mode': [ s:I1[0] , '#789f00' , s:I1[2] , 106 , '' ] , |
\ 'airline_a': [ s:I1[0] , '#789f00' , s:I1[2] , 106 , '' ] , |
||||||
\ 'mode_separator': [ '#789f00' , s:I2[1] , 106 , s:I2[3] , '' ] , |
|
||||||
\ } |
\ } |
||||||
|
|
||||||
|
|
||||||
let g:airline#themes#luna#replace = copy(g:airline#themes#luna#insert) |
let g:airline#themes#luna#palette.replace = copy(g:airline#themes#luna#palette.insert) |
||||||
let g:airline#themes#luna#replace.mode = [ s:I2[0] , '#920000' , s:I2[2] , 88 , '' ] |
let g:airline#themes#luna#palette.replace.airline_a = [ s:I2[0] , '#920000' , s:I2[2] , 88 , '' ] |
||||||
let g:airline#themes#luna#replace.mode_separator = [ '#920000' , s:I2[1] , 88 , s:I2[3] , '' ] |
let g:airline#themes#luna#palette.replace_modified = g:airline#themes#luna#palette.insert_modified |
||||||
let g:airline#themes#luna#replace_modified = g:airline#themes#luna#insert_modified |
|
||||||
|
|
||||||
let s:V1 = [ '#ffff9a' , '#ff8036' , 222 , 208 ] |
let s:V1 = [ '#ffff9a' , '#ff8036' , 222 , 208 ] |
||||||
let s:V2 = [ '#ffffff' , '#003f3f' , 231 , 29 ] |
let s:V2 = [ '#ffffff' , '#003f3f' , 231 , 29 ] |
||||||
let s:V3 = [ '#ffffff' , '#002b2b' , 231 , 23 ] |
let s:V3 = [ '#ffffff' , '#002b2b' , 231 , 23 ] |
||||||
let g:airline#themes#luna#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) |
let g:airline#themes#luna#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) |
||||||
let g:airline#themes#luna#visual_modified = { |
let g:airline#themes#luna#palette.visual_modified = { |
||||||
\ 'info_separator': [ '#003f3f' , '#450000' , 29 , 52 , '' ] , |
\ 'airline_c': [ '#ffffff' , '#450000' , 231 , 52 , '' ] , |
||||||
\ 'statusline': [ '#ffffff' , '#450000' , 231 , 52 , '' ] , |
|
||||||
\ } |
\ } |
||||||
|
|
||||||
let s:IA = [ '#4e4e4e' , '#002b2b' , 59 , 23 , '' ] |
let s:IA = [ '#4e4e4e' , '#002b2b' , 59 , 23 , '' ] |
||||||
let g:airline#themes#luna#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) |
let g:airline#themes#luna#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) |
||||||
let g:airline#themes#luna#inactive_modified = { |
let g:airline#themes#luna#palette.inactive_modified = { |
||||||
\ 'statusline': [ '#f88379' , '' , '210' , '' , '' ] , |
\ 'airline_c': [ '#450000' , '' , 52 , '' , '' ] , |
||||||
|
\ } |
||||||
|
|
||||||
|
let g:airline#themes#luna#palette.tabline = { |
||||||
|
\ 'airline_tab': ['#2aa198', '#003f3f', 231, 29, ''], |
||||||
|
\ 'airline_tabsel': ['#ffffff', '#2e8b57', 231, 36, ''], |
||||||
|
\ 'airline_tabtype': ['#ffffff', '#005252', 231, 36, ''], |
||||||
|
\ 'airline_tabfill': ['#ffffff', '#002b2b', 231, 23, ''], |
||||||
|
\ 'airline_tabmod': ['#ffffff', '#780000', 231, 88, ''], |
||||||
\ } |
\ } |
||||||
|
|
||||||
if get(g:, 'loaded_ctrlp', 0) |
let s:WI = [ '#ffffff', '#5f0000', 231, 88 ] |
||||||
let g:airline#themes#luna#ctrlp = airline#extensions#ctrlp#generate_color_map( |
let g:airline#themes#luna#palette.normal.airline_warning = [ |
||||||
\ [ '#ffffff' , '#002b2b' , 231 , 23 , '' ] , |
\ s:WI[0], s:WI[1], s:WI[2], s:WI[3] |
||||||
\ [ '#ffffff' , '#005252' , 231 , 36 , '' ] , |
\ ] |
||||||
\ [ '#ffffff' , '#973d45' , 231 , 95 , '' ] ) |
|
||||||
|
let g:airline#themes#luna#palette.normal_modified.airline_warning = |
||||||
|
\ g:airline#themes#luna#palette.normal.airline_warning |
||||||
|
|
||||||
|
let g:airline#themes#luna#palette.insert.airline_warning = |
||||||
|
\ g:airline#themes#luna#palette.normal.airline_warning |
||||||
|
|
||||||
|
let g:airline#themes#luna#palette.insert_modified.airline_warning = |
||||||
|
\ g:airline#themes#luna#palette.normal.airline_warning |
||||||
|
|
||||||
|
let g:airline#themes#luna#palette.visual.airline_warning = |
||||||
|
\ g:airline#themes#luna#palette.normal.airline_warning |
||||||
|
|
||||||
|
let g:airline#themes#luna#palette.visual_modified.airline_warning = |
||||||
|
\ g:airline#themes#luna#palette.normal.airline_warning |
||||||
|
|
||||||
|
let g:airline#themes#luna#palette.replace.airline_warning = |
||||||
|
\ g:airline#themes#luna#palette.normal.airline_warning |
||||||
|
|
||||||
|
let g:airline#themes#luna#palette.replace_modified.airline_warning = |
||||||
|
\ g:airline#themes#luna#palette.normal.airline_warning |
||||||
|
|
||||||
|
|
||||||
|
if !get(g:, 'loaded_ctrlp', 0) |
||||||
|
finish |
||||||
endif |
endif |
||||||
|
let g:airline#themes#luna#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( |
||||||
|
\ [ '#ffffff' , '#002b2b' , 231 , 23 , '' ] , |
||||||
|
\ [ '#ffffff' , '#005252' , 231 , 36 , '' ] , |
||||||
|
\ [ '#ffffff' , '#973d45' , 231 , 95 , '' ] ) |
||||||
|
|
||||||
|
@ -0,0 +1,15 @@ |
|||||||
|
let g:airline#themes#monochrome#palette = {} |
||||||
|
|
||||||
|
function! airline#themes#monochrome#refresh() |
||||||
|
let s:SL = airline#themes#get_highlight('StatusLine') |
||||||
|
let g:airline#themes#monochrome#palette.normal = airline#themes#generate_color_map(s:SL, s:SL, s:SL) |
||||||
|
let g:airline#themes#monochrome#palette.insert = g:airline#themes#monochrome#palette.normal |
||||||
|
let g:airline#themes#monochrome#palette.replace = g:airline#themes#monochrome#palette.normal |
||||||
|
let g:airline#themes#monochrome#palette.visual = g:airline#themes#monochrome#palette.normal |
||||||
|
|
||||||
|
let s:SLNC = airline#themes#get_highlight('StatusLineNC') |
||||||
|
let g:airline#themes#monochrome#palette.inactive = airline#themes#generate_color_map(s:SLNC, s:SLNC, s:SLNC) |
||||||
|
endfunction |
||||||
|
|
||||||
|
call airline#themes#monochrome#refresh() |
||||||
|
|
@ -0,0 +1,46 @@ |
|||||||
|
let g:airline#themes#murmur#palette = {} |
||||||
|
|
||||||
|
let s:termbg = 237 " Background for branch and file format blocks |
||||||
|
let s:termbg2= 234 " Background for middle block |
||||||
|
let s:normalbg= 27 " Background for normal mode and file position blocks |
||||||
|
let s:insertbg= 70 " Background for insert mode and file position blocks |
||||||
|
let s:visualbg= 166 " Background for visual mode and file position blocks |
||||||
|
let s:replacebg=88 " Background for replace mode and file position blocks |
||||||
|
let s:alert= 88 " Modefied file alert color |
||||||
|
|
||||||
|
let s:BB = ['#AFAF87', '#5F5F5F', 144, s:termbg] " Branch and file format blocks |
||||||
|
|
||||||
|
let s:N1 = ['#FFFFFF', '#5F87FF', 15, s:normalbg] " Outside blocks in normal mode |
||||||
|
let s:N2 = ['#AFAF87', '#5F5F5F', 39, s:termbg2] " Middle block |
||||||
|
let g:airline#themes#murmur#palette.normal = airline#themes#generate_color_map(s:N1, s:BB, s:N2) |
||||||
|
let g:airline#themes#murmur#palette.normal_modified = {'airline_c': ['#ffffff', '#5f005f', s:alert, s:termbg2, 'bold'] ,} |
||||||
|
|
||||||
|
let s:I1 = ['#FFFFFF', '#87AF5F', 15, s:insertbg] " Outside blocks in insert mode |
||||||
|
let s:I2 = ['#AFAF87', '#5F5F5F', s:insertbg, s:termbg2] " Middle block |
||||||
|
let g:airline#themes#murmur#palette.insert = airline#themes#generate_color_map(s:I1, s:BB, s:I2) |
||||||
|
let g:airline#themes#murmur#palette.insert_modified = {'airline_c': ['#AFAF87', '#5F5F5F', s:alert, s:termbg2, 'bold'] ,} |
||||||
|
|
||||||
|
let s:R1 = ['#FFFFFF', '#870000', 15, s:replacebg] " Outside blocks in replace mode |
||||||
|
let s:R2 = ['#AFAF87', '#5F5F5F', 255, s:termbg2] " Middle block |
||||||
|
let g:airline#themes#murmur#palette.replace = airline#themes#generate_color_map(s:R1, s:BB, s:R2) |
||||||
|
let g:airline#themes#murmur#palette.replace_modified = {'airline_c': ['#AFAF87', '#5f005f', s:alert, s:termbg2, 'bold'] ,} |
||||||
|
|
||||||
|
let s:V1 = ['#FFFFFF', '#AF5F00', 15, s:visualbg] " Outside blocks in visual mode |
||||||
|
let s:V2 = ['#AFAF87', '#5F5F5F', s:visualbg, s:termbg2] " Middle block |
||||||
|
let g:airline#themes#murmur#palette.visual = airline#themes#generate_color_map(s:V1, s:BB, s:V2) |
||||||
|
let g:airline#themes#murmur#palette.visual_modified = {'airline_c': [ '#AFAF87', '#5f005f', s:alert, s:termbg2, 'bold'] ,} |
||||||
|
|
||||||
|
" Inactive mode |
||||||
|
let s:IA1 = ['#4E4E4E', '#1C1C1C', 239, 234, ''] |
||||||
|
let s:IA2 = ['#4E4E4E', '#1C1C1C', 239, 234, ''] |
||||||
|
let s:IA3 = ['#4E4E4E', '#1C1C1C', 239, 234, ''] |
||||||
|
let g:airline#themes#murmur#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) |
||||||
|
|
||||||
|
" CtrlP plugin colors |
||||||
|
if !get(g:, 'loaded_ctrlp', 0) |
||||||
|
finish |
||||||
|
endif |
||||||
|
let g:airline#themes#murmur#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( |
||||||
|
\ ['#FFFFFF', '#5F87FF', 15, s:normalbg, ''], |
||||||
|
\ ['#AFAF87', '#5F5F5F', 144, s:termbg, ''], |
||||||
|
\ ['#AFAF87', '#5F5F5F', 39, s:termbg2, 'bold']) |
@ -0,0 +1,41 @@ |
|||||||
|
let g:airline#themes#serene#palette = {} |
||||||
|
|
||||||
|
let s:guibg = '#080808' |
||||||
|
let s:termbg = 232 |
||||||
|
let s:termsep = 236 |
||||||
|
let s:guisep = '#303030' |
||||||
|
|
||||||
|
let s:N1 = [ '#00dfff' , s:guibg , 45 , s:termbg ] |
||||||
|
let s:N2 = [ '#ff5f00' , s:guibg , 202 , s:termbg ] |
||||||
|
let s:N3 = [ '#767676' , s:guibg , 7 , s:termbg ] |
||||||
|
|
||||||
|
let g:airline#themes#serene#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
||||||
|
let g:airline#themes#serene#palette.normal_modified = { |
||||||
|
\ 'airline_c': [ '#df0000' , s:guibg, 160 , s:termbg , '' ] , |
||||||
|
\ } |
||||||
|
|
||||||
|
let s:I1 = [ '#5fff00' , s:guibg , 82 , s:termbg ] |
||||||
|
let s:I2 = [ '#ff5f00' , s:guibg , 202 , s:termbg ] |
||||||
|
let s:I3 = [ '#767676' , s:guibg , 7 , s:termbg ] |
||||||
|
let g:airline#themes#serene#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) |
||||||
|
let g:airline#themes#serene#palette.insert_modified = copy(g:airline#themes#serene#palette.normal_modified) |
||||||
|
let g:airline#themes#serene#palette.insert_paste = { |
||||||
|
\ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] , |
||||||
|
\ } |
||||||
|
|
||||||
|
let g:airline#themes#serene#palette.replace = { |
||||||
|
\ 'airline_a': [ s:I1[0] , '#af0000' , s:I1[2] , 124 , '' ] , |
||||||
|
\ } |
||||||
|
let g:airline#themes#serene#palette.replace_modified = copy(g:airline#themes#serene#palette.normal_modified) |
||||||
|
|
||||||
|
let s:V1 = [ '#dfdf00' , s:guibg , 184 , s:termbg ] |
||||||
|
let s:V2 = [ '#ff5f00' , s:guibg , 202 , s:termbg ] |
||||||
|
let s:V3 = [ '#767676' , s:guibg , 7 , s:termbg ] |
||||||
|
let g:airline#themes#serene#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) |
||||||
|
let g:airline#themes#serene#palette.visual_modified = copy(g:airline#themes#serene#palette.normal_modified) |
||||||
|
|
||||||
|
let s:IA = [ '#4e4e4e' , s:guibg , 239 , s:termbg , '' ] |
||||||
|
let s:IA2 = [ '#4e4e4e' , s:guisep , 239 , s:termsep , '' ] |
||||||
|
let g:airline#themes#serene#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA2, s:IA2) |
||||||
|
let g:airline#themes#serene#palette.inactive_modified = copy(g:airline#themes#serene#palette.normal_modified) |
||||||
|
|
@ -0,0 +1,90 @@ |
|||||||
|
" vim-airline companion theme of Sol |
||||||
|
" (https://github.com/Pychimp/vim-sol) |
||||||
|
|
||||||
|
let g:airline#themes#sol#palette = {} |
||||||
|
|
||||||
|
let g:airline#themes#sol#palette.accents = { |
||||||
|
\ 'red': [ '#ffffff' , '' , 231 , '' , '' ], |
||||||
|
\ } |
||||||
|
|
||||||
|
let s:N1 = [ '#343434' , '#a0a0a0' , 237 , 248 ] |
||||||
|
let s:N2 = [ '#343434' , '#b3b3b3' , 237 , 250 ] |
||||||
|
let s:N3 = [ '#343434' , '#c7c7c7' , 237 , 252 ] |
||||||
|
let g:airline#themes#sol#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
||||||
|
let g:airline#themes#sol#palette.normal_modified = { |
||||||
|
\ 'airline_c': [ '#ffffff' , '#ff3535' , 231 , 203 , '' ] , |
||||||
|
\ } |
||||||
|
|
||||||
|
|
||||||
|
let s:I1 = [ '#eeeeee' , '#09643f' , 255 , 30 ] |
||||||
|
let s:I2 = [ '#343434' , '#a3a3a3' , 237 , 249 ] |
||||||
|
let s:I3 = [ '#343434' , '#b0b0b0' , 237 , 250 ] |
||||||
|
let g:airline#themes#sol#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) |
||||||
|
let g:airline#themes#sol#palette.insert_modified = { |
||||||
|
\ 'airline_c': [ '#ffffff' , '#ff6868' , 225 , 167 , '' ] , |
||||||
|
\ } |
||||||
|
let g:airline#themes#sol#palette.insert_paste = { |
||||||
|
\ 'airline_a': [ s:I1[0] , '#09643f' , s:I1[2] , 30 , '' ] , |
||||||
|
\ } |
||||||
|
|
||||||
|
|
||||||
|
let g:airline#themes#sol#palette.replace = copy(g:airline#themes#sol#palette.insert) |
||||||
|
let g:airline#themes#sol#palette.replace.airline_a = [ s:I1[0] , '#ff2121' , s:I1[2] , 196 , '' ] |
||||||
|
let g:airline#themes#sol#palette.replace.airline_z = [ s:I1[0] , '#ff2121' , s:I1[2] , 196 , '' ] |
||||||
|
let g:airline#themes#sol#palette.replace_modified = g:airline#themes#sol#palette.insert_modified |
||||||
|
|
||||||
|
let s:V1 = [ '#ffff9a' , '#ff6003' , 222 , 202 ] |
||||||
|
let s:V2 = [ '#343434' , '#a3a3a3' , 237 , 249 ] |
||||||
|
let s:V3 = [ '#343434' , '#b0b0b0' , 237 , 250 ] |
||||||
|
let g:airline#themes#sol#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) |
||||||
|
let g:airline#themes#sol#palette.visual_modified = { |
||||||
|
\ 'airline_c': [ '#ffffff' , '#ff3535' , 231 , 203 , '' ] , |
||||||
|
\ } |
||||||
|
|
||||||
|
let s:IA = [ '#777777' , '#c7c7c7' , 244 , 251 , '' ] |
||||||
|
let g:airline#themes#sol#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) |
||||||
|
let g:airline#themes#sol#palette.inactive_modified = { |
||||||
|
\ 'airline_c': [ '#ff3535' , '' , 203 , '' , '' ] , |
||||||
|
\ } |
||||||
|
|
||||||
|
let g:airline#themes#sol#palette.tabline = { |
||||||
|
\ 'airline_tab': ['#343434', '#b3b3b3', 237, 250, ''], |
||||||
|
\ 'airline_tabsel': ['#ffffff', '#004b9a', 231, 31 , ''], |
||||||
|
\ 'airline_tabtype': ['#343434', '#a0a0a0', 237, 248, ''], |
||||||
|
\ 'airline_tabfill': ['#343434', '#c7c7c7', 237, 251, ''], |
||||||
|
\ 'airline_tabmod': ['#ffffff', '#ff6868', 231, 167, ''], |
||||||
|
\ } |
||||||
|
|
||||||
|
let s:WI = [ '#eeeeee', '#ff0f38', 255, 201 ] |
||||||
|
let g:airline#themes#sol#palette.normal.airline_warning = [ |
||||||
|
\ s:WI[0], s:WI[1], s:WI[2], s:WI[3] |
||||||
|
\ ] |
||||||
|
|
||||||
|
let g:airline#themes#sol#palette.normal_modified.airline_warning = |
||||||
|
\ g:airline#themes#sol#palette.normal.airline_warning |
||||||
|
|
||||||
|
let g:airline#themes#sol#palette.insert.airline_warning = |
||||||
|
\ g:airline#themes#sol#palette.normal.airline_warning |
||||||
|
|
||||||
|
let g:airline#themes#sol#palette.insert_modified.airline_warning = |
||||||
|
\ g:airline#themes#sol#palette.normal.airline_warning |
||||||
|
|
||||||
|
let g:airline#themes#sol#palette.visual.airline_warning = |
||||||
|
\ g:airline#themes#sol#palette.normal.airline_warning |
||||||
|
|
||||||
|
let g:airline#themes#sol#palette.visual_modified.airline_warning = |
||||||
|
\ g:airline#themes#sol#palette.normal.airline_warning |
||||||
|
|
||||||
|
let g:airline#themes#sol#palette.replace.airline_warning = |
||||||
|
\ g:airline#themes#sol#palette.normal.airline_warning |
||||||
|
|
||||||
|
let g:airline#themes#sol#palette.replace_modified.airline_warning = |
||||||
|
\ g:airline#themes#sol#palette.normal.airline_warning |
||||||
|
|
||||||
|
if !get(g:, 'loaded_ctrlp', 0) |
||||||
|
finish |
||||||
|
endif |
||||||
|
let g:airline#themes#sol#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( |
||||||
|
\ [ '#343434' , '#c7c7c7' , 237 , 251 , '' ] , |
||||||
|
\ [ '#343434' , '#b3b3b3' , 237 , 250 , '' ] , |
||||||
|
\ [ '#eeeeee' , '#007fff' , 255 , 27 , '' ] ) |
@ -1,40 +1,44 @@ |
|||||||
function! s:generate() |
let g:airline#themes#tomorrow#palette = {} |
||||||
let s:file = airline#themes#get_highlight('Constant') |
|
||||||
|
function! airline#themes#tomorrow#refresh() |
||||||
|
let g:airline#themes#tomorrow#palette.accents = { |
||||||
|
\ 'red': airline#themes#get_highlight('Constant'), |
||||||
|
\ } |
||||||
|
|
||||||
let s:N1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Directory', 'fg'], 'bold') |
let s:N1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Directory', 'fg'], 'bold') |
||||||
let s:N2 = airline#themes#get_highlight('Pmenu') |
let s:N2 = airline#themes#get_highlight('Pmenu') |
||||||
let s:N3 = airline#themes#get_highlight('CursorLine') |
let s:N3 = airline#themes#get_highlight('CursorLine') |
||||||
let g:airline#themes#tomorrow#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file) |
let g:airline#themes#tomorrow#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
||||||
|
|
||||||
let group = airline#themes#get_highlight('vimCommand') |
let group = airline#themes#get_highlight('vimCommand') |
||||||
let g:airline#themes#tomorrow#normal_modified = { |
let g:airline#themes#tomorrow#palette.normal_modified = { |
||||||
\ 'statusline': [ group[0], '', group[2], '', '' ] |
\ 'airline_c': [ group[0], '', group[2], '', '' ] |
||||||
\ } |
\ } |
||||||
|
|
||||||
let s:I1 = airline#themes#get_highlight2(['Normal', 'bg'], ['MoreMsg', 'fg'], 'bold') |
let s:I1 = airline#themes#get_highlight2(['Normal', 'bg'], ['MoreMsg', 'fg'], 'bold') |
||||||
let s:I2 = airline#themes#get_highlight2(['MoreMsg', 'fg'], ['Normal', 'bg']) |
let s:I2 = airline#themes#get_highlight2(['MoreMsg', 'fg'], ['Normal', 'bg']) |
||||||
let s:I3 = s:N3 |
let s:I3 = s:N3 |
||||||
let g:airline#themes#tomorrow#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file) |
let g:airline#themes#tomorrow#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) |
||||||
let g:airline#themes#tomorrow#insert_modified = g:airline#themes#tomorrow#normal_modified |
let g:airline#themes#tomorrow#palette.insert_modified = g:airline#themes#tomorrow#palette.normal_modified |
||||||
|
|
||||||
let s:R1 = airline#themes#get_highlight('Error', 'bold') |
let s:R1 = airline#themes#get_highlight('Error', 'bold') |
||||||
let s:R2 = s:N2 |
let s:R2 = s:N2 |
||||||
let s:R3 = s:N3 |
let s:R3 = s:N3 |
||||||
let g:airline#themes#tomorrow#replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3, s:file) |
let g:airline#themes#tomorrow#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) |
||||||
let g:airline#themes#tomorrow#replace_modified = g:airline#themes#tomorrow#normal_modified |
let g:airline#themes#tomorrow#palette.replace_modified = g:airline#themes#tomorrow#palette.normal_modified |
||||||
|
|
||||||
let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Constant', 'fg'], 'bold') |
let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Constant', 'fg'], 'bold') |
||||||
let s:V2 = airline#themes#get_highlight2(['Constant', 'fg'], ['Normal', 'bg']) |
let s:V2 = airline#themes#get_highlight2(['Constant', 'fg'], ['Normal', 'bg']) |
||||||
let s:V3 = s:N3 |
let s:V3 = s:N3 |
||||||
let g:airline#themes#tomorrow#visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file) |
let g:airline#themes#tomorrow#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) |
||||||
let g:airline#themes#tomorrow#visual_modified = g:airline#themes#tomorrow#normal_modified |
let g:airline#themes#tomorrow#palette.visual_modified = g:airline#themes#tomorrow#palette.normal_modified |
||||||
|
|
||||||
let s:IA = airline#themes#get_highlight2(['NonText', 'fg'], ['CursorLine', 'bg']) |
let s:IA = airline#themes#get_highlight2(['NonText', 'fg'], ['CursorLine', 'bg']) |
||||||
let g:airline#themes#tomorrow#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file) |
let g:airline#themes#tomorrow#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) |
||||||
|
let g:airline#themes#tomorrow#palette.inactive_modified = { |
||||||
|
\ 'airline_c': [ group[0], '', group[2], '', '' ] |
||||||
|
\ } |
||||||
endfunction |
endfunction |
||||||
|
|
||||||
call s:generate() |
call airline#themes#tomorrow#refresh() |
||||||
augroup airline_tomorrow |
|
||||||
autocmd! |
|
||||||
autocmd ColorScheme * call <sid>generate() | call airline#reload_highlight() |
|
||||||
augroup END |
|
||||||
|
@ -0,0 +1,43 @@ |
|||||||
|
let g:airline#themes#understated#palette = {} |
||||||
|
|
||||||
|
let s:N1 = ['#FFFFFF', '#5F87FF', 15, 69] " Outside blocks in normal mode (mode and file position) |
||||||
|
let s:N2 = ['#AFAF87', '#5F5F5F', 144, 59] " Next blocks inside (branch and file format) |
||||||
|
let s:N3 = ['#AFAF87', '#5F5F5F', 144, 59] " The middle block |
||||||
|
|
||||||
|
let g:airline#themes#understated#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
||||||
|
let g:airline#themes#understated#palette.normal_modified = {'airline_c': ['#ffffff', '#5f005f', 144, 59, 'bold'] ,} |
||||||
|
|
||||||
|
let s:I1 = ['#FFFFFF', '#87AF5F', 15, 107] " Outside blocks in normal mode (mode and file position) |
||||||
|
let s:I2 = ['#AFAF87', '#5F5F5F', 144, 59] " Next blocks inside (branch and file format) |
||||||
|
let s:I3 = ['#AFAF87', '#5F5F5F', 144, 59] " The middle block |
||||||
|
let g:airline#themes#understated#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) |
||||||
|
let g:airline#themes#understated#palette.insert_modified = {'airline_c': ['#AFAF87', '#5F5F5F', 144, 59, 'bold'] ,} |
||||||
|
let g:airline#themes#understated#palette.insert_paste = {'airline_c': ['#AFAF87', '#5F5F5F', 144, 59, ''] ,} |
||||||
|
|
||||||
|
let g:airline#themes#understated#palette.replace = airline#themes#generate_color_map(s:I1, s:I2, s:I3) |
||||||
|
let g:airline#themes#understated#palette.replace.airline_a = ['#FFFFFF', '#870000', 15, 88, ''] |
||||||
|
let g:airline#themes#understated#palette.replace_modified = {'airline_c': ['#AFAF87', '#5F5F5F', 144, 59, 'bold'] ,} |
||||||
|
|
||||||
|
let s:V1 = ['#FFFFFF', '#AF5F00', 15, 130] |
||||||
|
let s:V2 = ['#AFAF87', '#5F5F5F', 144, 59] |
||||||
|
let s:V3 = ['#AFAF87', '#5F5F5F', 144, 59] |
||||||
|
let g:airline#themes#understated#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) |
||||||
|
let g:airline#themes#understated#palette.visual_modified = {'airline_c': [ '#AFAF87', '#5f005f', 144, 59, 'bold'] ,} |
||||||
|
|
||||||
|
let s:V1 = ['#080808', '#FFAF00', 232, 214] |
||||||
|
let s:IA1 = ['#4E4E4E', '#1C1C1C', 239, 234, ''] |
||||||
|
let s:IA2 = ['#4E4E4E', '#1C1C1C', 239, 234, ''] |
||||||
|
let s:IA3 = ['#4E4E4E', '#1C1C1C', 239, 234, ''] |
||||||
|
let g:airline#themes#understated#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) |
||||||
|
let g:airline#themes#understated#palette.inactive_modified = {'airline_c': ['#4E4E4E', '', 239, '', 'bold'] ,} |
||||||
|
|
||||||
|
let g:airline#themes#understated#palette.accents = {'red': ['#FF0000', '', 88, '']} |
||||||
|
|
||||||
|
if !get(g:, 'loaded_ctrlp', 0) |
||||||
|
finish |
||||||
|
endif |
||||||
|
let g:airline#themes#understated#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( |
||||||
|
\ ['#FFFFFF', '#1C1C1C', 15, 234, '' ], |
||||||
|
\ ['#FFFFFF', '#262626', 15, 235, '' ], |
||||||
|
\ ['#FFFFFF', '#303030', 15, 236, 'bold']) |
||||||
|
|
@ -0,0 +1,44 @@ |
|||||||
|
let g:airline#themes#zenburn#palette = {} |
||||||
|
|
||||||
|
function! airline#themes#zenburn#refresh() |
||||||
|
let g:airline#themes#zenburn#palette.accents = { |
||||||
|
\ 'red': airline#themes#get_highlight('Constant'), |
||||||
|
\ } |
||||||
|
|
||||||
|
let s:N1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['Folded', 'fg'], 'bold') |
||||||
|
let s:N2 = airline#themes#get_highlight('Folded') |
||||||
|
let s:N3 = airline#themes#get_highlight('NonText') |
||||||
|
|
||||||
|
let g:airline#themes#zenburn#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) |
||||||
|
let s:Nmod = airline#themes#get_highlight('Comment') |
||||||
|
let g:airline#themes#zenburn#palette.normal_modified = { |
||||||
|
\ 'airline_c': s:Nmod |
||||||
|
\ } |
||||||
|
|
||||||
|
let s:I1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['String', 'fg'], 'bold') |
||||||
|
let s:I2 = airline#themes#get_highlight2(['String', 'fg'], ['Folded', 'bg']) |
||||||
|
let s:I3 = s:N3 |
||||||
|
let g:airline#themes#zenburn#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) |
||||||
|
let g:airline#themes#zenburn#palette.insert_modified = g:airline#themes#zenburn#palette.normal_modified |
||||||
|
|
||||||
|
let s:R1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['Comment', 'fg'], 'bold') |
||||||
|
let s:R2 = airline#themes#get_highlight2(['Comment', 'fg'], ['Folded', 'bg']) |
||||||
|
let s:R3 = s:N3 |
||||||
|
let g:airline#themes#zenburn#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) |
||||||
|
let g:airline#themes#zenburn#palette.replace_modified = g:airline#themes#zenburn#palette.normal_modified |
||||||
|
|
||||||
|
let s:V1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['Identifier', 'fg'], 'bold') |
||||||
|
let s:V2 = airline#themes#get_highlight2(['Identifier', 'fg'], ['Folded', 'bg']) |
||||||
|
let s:V3 = s:N3 |
||||||
|
let g:airline#themes#zenburn#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) |
||||||
|
let g:airline#themes#zenburn#palette.visual_modified = g:airline#themes#zenburn#palette.normal_modified |
||||||
|
|
||||||
|
let s:IA = airline#themes#get_highlight('NonText') |
||||||
|
let g:airline#themes#zenburn#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) |
||||||
|
let g:airline#themes#zenburn#palette.inactive_modified = { |
||||||
|
\ 'airline_c': s:Nmod |
||||||
|
\ } |
||||||
|
endfunction |
||||||
|
|
||||||
|
call airline#themes#zenburn#refresh() |
||||||
|
|
@ -0,0 +1,64 @@ |
|||||||
|
" MIT License. Copyright (c) 2013 Bailey Ling. |
||||||
|
" vim: et ts=2 sts=2 sw=2 |
||||||
|
|
||||||
|
call airline#init#bootstrap() |
||||||
|
let s:spc = g:airline_symbols.space |
||||||
|
|
||||||
|
function! airline#util#wrap(text, minwidth) |
||||||
|
if a:minwidth > 0 && winwidth(0) < a:minwidth |
||||||
|
return '' |
||||||
|
endif |
||||||
|
return a:text |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#util#append(text, minwidth) |
||||||
|
if a:minwidth > 0 && winwidth(0) < a:minwidth |
||||||
|
return '' |
||||||
|
endif |
||||||
|
let prefix = s:spc == "\ua0" ? s:spc : s:spc.s:spc |
||||||
|
return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! airline#util#prepend(text, minwidth) |
||||||
|
if a:minwidth > 0 && winwidth(0) < a:minwidth |
||||||
|
return '' |
||||||
|
endif |
||||||
|
return empty(a:text) ? '' : a:text.s:spc.g:airline_right_alt_sep.s:spc |
||||||
|
endfunction |
||||||
|
|
||||||
|
if v:version >= 704 |
||||||
|
function! airline#util#getwinvar(winnr, key, def) |
||||||
|
return getwinvar(a:winnr, a:key, a:def) |
||||||
|
endfunction |
||||||
|
else |
||||||
|
function! airline#util#getwinvar(winnr, key, def) |
||||||
|
let winvals = getwinvar(a:winnr, '') |
||||||
|
return get(winvals, a:key, a:def) |
||||||
|
endfunction |
||||||
|
endif |
||||||
|
|
||||||
|
if v:version >= 704 |
||||||
|
function! airline#util#exec_funcrefs(list, ...) |
||||||
|
for Fn in a:list |
||||||
|
let code = call(Fn, a:000) |
||||||
|
if code != 0 |
||||||
|
return code |
||||||
|
endif |
||||||
|
endfor |
||||||
|
return 0 |
||||||
|
endfunction |
||||||
|
else |
||||||
|
function! airline#util#exec_funcrefs(list, ...) |
||||||
|
" for 7.2; we cannot iterate the list, hence why we use range() |
||||||
|
" for 7.3-[97, 328]; we cannot reuse the variable, hence the {} |
||||||
|
for i in range(0, len(a:list) - 1) |
||||||
|
let Fn{i} = a:list[i] |
||||||
|
let code = call(Fn{i}, a:000) |
||||||
|
if code != 0 |
||||||
|
return code |
||||||
|
endif |
||||||
|
endfor |
||||||
|
return 0 |
||||||
|
endfunction |
||||||
|
endif |
||||||
|
|
@ -0,0 +1,87 @@ |
|||||||
|
let g:airline_theme = 'dark' |
||||||
|
call airline#init#bootstrap() |
||||||
|
call airline#init#sections() |
||||||
|
source plugin/airline.vim |
||||||
|
|
||||||
|
function! MyFuncref(...) |
||||||
|
call a:1.add_raw('hello world') |
||||||
|
return 1 |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! MyIgnoreFuncref(...) |
||||||
|
return -1 |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! MyAppend1(...) |
||||||
|
call a:1.add_raw('hello') |
||||||
|
endfunction |
||||||
|
|
||||||
|
function! MyAppend2(...) |
||||||
|
call a:1.add_raw('world') |
||||||
|
endfunction |
||||||
|
|
||||||
|
describe 'airline' |
||||||
|
before |
||||||
|
let g:airline_statusline_funcrefs = [] |
||||||
|
end |
||||||
|
|
||||||
|
it 'should run user funcrefs first' |
||||||
|
call airline#add_statusline_func('MyFuncref') |
||||||
|
let &statusline = '' |
||||||
|
call airline#update_statusline() |
||||||
|
Expect airline#statusline(1) =~ 'hello world' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should not change the statusline with -1' |
||||||
|
call airline#add_statusline_funcref(function('MyIgnoreFuncref')) |
||||||
|
let &statusline = 'foo' |
||||||
|
call airline#update_statusline() |
||||||
|
Expect &statusline == 'foo' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should support multiple chained funcrefs' |
||||||
|
call airline#add_statusline_func('MyAppend1') |
||||||
|
call airline#add_statusline_func('MyAppend2') |
||||||
|
call airline#update_statusline() |
||||||
|
Expect airline#statusline(1) =~ 'helloworld' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should allow users to redefine sections' |
||||||
|
let g:airline_section_a = airline#section#create(['mode', 'mode']) |
||||||
|
call airline#update_statusline() |
||||||
|
Expect airline#statusline(1) =~ '%{airline#util#wrap(airline#parts#mode(),0)}%#airline_a#%#airline_a_bold#%{airline#util#wrap(airline#parts#mode(),0)}%#airline_a#' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should remove funcrefs properly' |
||||||
|
let c = len(g:airline_statusline_funcrefs) |
||||||
|
call airline#add_statusline_func('MyIgnoreFuncref') |
||||||
|
call airline#remove_statusline_func('MyIgnoreFuncref') |
||||||
|
Expect len(g:airline_statusline_funcrefs) == c |
||||||
|
end |
||||||
|
|
||||||
|
it 'should overwrite the statusline with active and inactive splits' |
||||||
|
wincmd s |
||||||
|
Expect airline#statusline(1) !~ 'inactive' |
||||||
|
Expect airline#statusline(2) =~ 'inactive' |
||||||
|
wincmd c |
||||||
|
end |
||||||
|
|
||||||
|
it 'should collapse the inactive split if the variable is set true' |
||||||
|
let g:airline_inactive_collapse = 1 |
||||||
|
wincmd s |
||||||
|
Expect getwinvar(2, '&statusline') !~ 'airline#parts#mode' |
||||||
|
wincmd c |
||||||
|
end |
||||||
|
|
||||||
|
it 'should not collapse the inactive split if the variable is set false' |
||||||
|
let g:airline_inactive_collapse = 0 |
||||||
|
wincmd s |
||||||
|
Expect getwinvar(2, '&statusline') != 'airline#parts#mode' |
||||||
|
wincmd c |
||||||
|
end |
||||||
|
|
||||||
|
it 'should include check_mode' |
||||||
|
Expect airline#statusline(1) =~ 'airline#check_mode' |
||||||
|
end |
||||||
|
end |
||||||
|
|
@ -0,0 +1,80 @@ |
|||||||
|
let g:airline_theme = 'dark' |
||||||
|
call airline#init#bootstrap() |
||||||
|
|
||||||
|
describe 'active builder' |
||||||
|
before |
||||||
|
let s:builder = airline#builder#new({'active': 1}) |
||||||
|
end |
||||||
|
|
||||||
|
it 'should start with an empty statusline' |
||||||
|
let stl = s:builder.build() |
||||||
|
Expect stl == '' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should transition colors from one to the next' |
||||||
|
call s:builder.add_section('Normal', 'hello') |
||||||
|
call s:builder.add_section('NonText', 'world') |
||||||
|
let stl = s:builder.build() |
||||||
|
Expect stl =~ '%#Normal#hello%#Normal_to_NonText#>%#NonText#world' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should split left/right sections' |
||||||
|
call s:builder.split() |
||||||
|
let stl = s:builder.build() |
||||||
|
Expect stl =~ '%=' |
||||||
|
end |
||||||
|
|
||||||
|
it 'after split, sections use the right separator' |
||||||
|
call s:builder.split() |
||||||
|
call s:builder.add_section('Normal', 'hello') |
||||||
|
call s:builder.add_section('NonText', 'world') |
||||||
|
let stl = s:builder.build() |
||||||
|
Expect stl =~ '%#Normal#hello%#Normal_to_NonText#<%#NonText#world' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should not repeat the same highlight group' |
||||||
|
call s:builder.add_section('Normal', 'hello') |
||||||
|
call s:builder.add_section('Normal', 'hello') |
||||||
|
let stl = s:builder.build() |
||||||
|
Expect stl == '%#Normal#hello>hello' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should replace accent groups with the specified group' |
||||||
|
call s:builder.add_section('Normal', '%#__accent_foo#hello') |
||||||
|
let stl = s:builder.build() |
||||||
|
Expect stl == '%#Normal#%#Normal_foo#hello' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should replace two accent groups with correct groups' |
||||||
|
call s:builder.add_section('Normal', '%#__accent_foo#hello%#__accent_bar#world') |
||||||
|
let stl = s:builder.build() |
||||||
|
Expect stl =~ '%#Normal_foo#hello%#Normal_bar#world' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should special restore group should go back to previous group' |
||||||
|
call s:builder.add_section('Normal', '%#__restore__#') |
||||||
|
let stl = s:builder.build() |
||||||
|
Expect stl !~ '%#__restore__#' |
||||||
|
Expect stl =~ '%#Normal#' |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
describe 'inactive builder' |
||||||
|
before |
||||||
|
let s:builder = airline#builder#new({'active': 0}) |
||||||
|
end |
||||||
|
|
||||||
|
it 'should transition colors from one to the next' |
||||||
|
call s:builder.add_section('Normal', 'hello') |
||||||
|
call s:builder.add_section('NonText', 'world') |
||||||
|
let stl = s:builder.build() |
||||||
|
Expect stl =~ '%#Normal_inactive#hello%#Normal_to_NonText_inactive#>%#NonText_inactive#world' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should not render accents' |
||||||
|
call s:builder.add_section('Normal', '%#__accent_foo#hello%#foo#foo%#__accent_bar#world') |
||||||
|
let stl = s:builder.build() |
||||||
|
Expect stl == '%#Normal_inactive#hello%#foo_inactive#fooworld' |
||||||
|
end |
||||||
|
end |
||||||
|
|
@ -0,0 +1,33 @@ |
|||||||
|
call airline#init#bootstrap() |
||||||
|
call airline#init#sections() |
||||||
|
|
||||||
|
source plugin/airline.vim |
||||||
|
|
||||||
|
describe 'commands' |
||||||
|
it 'should toggle off and on' |
||||||
|
execute 'AirlineToggle' |
||||||
|
Expect exists('#airline') to_be_false |
||||||
|
execute 'AirlineToggle' |
||||||
|
Expect exists('#airline') to_be_true |
||||||
|
end |
||||||
|
|
||||||
|
it 'should toggle whitespace off and on' |
||||||
|
call airline#extensions#load() |
||||||
|
execute 'AirlineToggleWhitespace' |
||||||
|
Expect exists('#airline_whitespace') to_be_false |
||||||
|
execute 'AirlineToggleWhitespace' |
||||||
|
Expect exists('#airline_whitespace') to_be_true |
||||||
|
end |
||||||
|
|
||||||
|
it 'should display theme name with no args' |
||||||
|
execute 'AirlineTheme simple' |
||||||
|
Expect g:airline_theme == 'simple' |
||||||
|
execute 'AirlineTheme dark' |
||||||
|
Expect g:airline_theme == 'dark' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should have a refresh command' |
||||||
|
Expect exists(':AirlineRefresh') to_be_true |
||||||
|
end |
||||||
|
end |
||||||
|
|
@ -0,0 +1,32 @@ |
|||||||
|
let g:airline_theme = 'dark' |
||||||
|
call airline#init#bootstrap() |
||||||
|
call airline#init#sections() |
||||||
|
source plugin/airline.vim |
||||||
|
|
||||||
|
describe 'default' |
||||||
|
before |
||||||
|
let s:builder = airline#builder#new({'active': 1}) |
||||||
|
end |
||||||
|
|
||||||
|
it 'should use the layout' |
||||||
|
let g:airline#extensions#default#layout = [ |
||||||
|
\ [ 'c', 'a', 'b', 'warning' ], |
||||||
|
\ [ 'x', 'z', 'y' ] |
||||||
|
\ ] |
||||||
|
call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 }) |
||||||
|
let stl = s:builder.build() |
||||||
|
Expect stl =~ 'airline_c_to_airline_a' |
||||||
|
Expect stl =~ 'airline_a_to_airline_b' |
||||||
|
Expect stl =~ 'airline_b_to_airline_warning' |
||||||
|
Expect stl =~ 'airline_x_to_airline_z' |
||||||
|
Expect stl =~ 'airline_z_to_airline_y' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should only render warning section in active splits' |
||||||
|
wincmd s |
||||||
|
Expect airline#statusline(1) =~ 'warning' |
||||||
|
Expect airline#statusline(2) !~ 'warning' |
||||||
|
wincmd c |
||||||
|
end |
||||||
|
end |
||||||
|
|
@ -0,0 +1,20 @@ |
|||||||
|
let g:airline_theme = 'dark' |
||||||
|
|
||||||
|
describe 'highlighter' |
||||||
|
it 'should create separator highlight groups' |
||||||
|
hi Foo1 ctermfg=1 ctermbg=2 |
||||||
|
hi Foo2 ctermfg=3 ctermbg=4 |
||||||
|
call airline#highlighter#add_separator('Foo1', 'Foo2', 0) |
||||||
|
let hl = airline#highlighter#get_highlight('Foo1_to_Foo2') |
||||||
|
Expect hl == [ '', '', '4', '2', '' ] |
||||||
|
end |
||||||
|
|
||||||
|
it 'should populate accent colors' |
||||||
|
Expect exists('g:airline#themes#dark#palette.normal.airline_c_red') to_be_false |
||||||
|
Expect hlID('airline_c_red') == 0 |
||||||
|
call airline#themes#patch(g:airline#themes#dark#palette) |
||||||
|
call airline#highlighter#highlight(['normal']) |
||||||
|
Expect hlID('airline_c_red') != 0 |
||||||
|
end |
||||||
|
end |
||||||
|
|
@ -0,0 +1,77 @@ |
|||||||
|
let s:sections = ['a', 'b', 'c', 'gutter', 'x', 'y', 'z', 'warning'] |
||||||
|
|
||||||
|
function! s:clear() |
||||||
|
for key in s:sections |
||||||
|
unlet! g:airline_section_{key} |
||||||
|
endfor |
||||||
|
endfunction |
||||||
|
|
||||||
|
call airline#init#bootstrap() |
||||||
|
|
||||||
|
describe 'init sections' |
||||||
|
before |
||||||
|
call s:clear() |
||||||
|
call airline#init#sections() |
||||||
|
end |
||||||
|
|
||||||
|
after |
||||||
|
call s:clear() |
||||||
|
end |
||||||
|
|
||||||
|
it 'section a should have mode, paste, iminsert' |
||||||
|
Expect g:airline_section_a =~ 'mode' |
||||||
|
Expect g:airline_section_a =~ 'paste' |
||||||
|
Expect g:airline_section_a =~ 'iminsert' |
||||||
|
end |
||||||
|
|
||||||
|
it 'section b should be blank because no extensions are installed' |
||||||
|
Expect g:airline_section_b == '' |
||||||
|
end |
||||||
|
|
||||||
|
it 'section c should be file' |
||||||
|
Expect g:airline_section_c == '%<%f%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#' |
||||||
|
end |
||||||
|
|
||||||
|
it 'section x should be filetype' |
||||||
|
Expect g:airline_section_x == '%{airline#util#wrap(airline#parts#filetype(),0)}' |
||||||
|
end |
||||||
|
|
||||||
|
it 'section y should be fenc and ff' |
||||||
|
Expect g:airline_section_y =~ 'ff' |
||||||
|
Expect g:airline_section_y =~ 'fenc' |
||||||
|
end |
||||||
|
|
||||||
|
it 'section z should be line numbers' |
||||||
|
Expect g:airline_section_z =~ '%3p%%' |
||||||
|
Expect g:airline_section_z =~ '%4l' |
||||||
|
Expect g:airline_section_z =~ '%3c' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should not redefine sections already defined' |
||||||
|
for s in s:sections |
||||||
|
let g:airline_section_{s} = s |
||||||
|
endfor |
||||||
|
call airline#init#bootstrap() |
||||||
|
for s in s:sections |
||||||
|
Expect g:airline_section_{s} == s |
||||||
|
endfor |
||||||
|
end |
||||||
|
|
||||||
|
it 'all default statusline extensions should be blank' |
||||||
|
Expect airline#parts#get('hunks').raw == '' |
||||||
|
Expect airline#parts#get('branch').raw == '' |
||||||
|
Expect airline#parts#get('tagbar').raw == '' |
||||||
|
Expect airline#parts#get('syntastic').raw == '' |
||||||
|
Expect airline#parts#get('eclim').raw == '' |
||||||
|
Expect airline#parts#get('whitespace').raw == '' |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
describe 'init parts' |
||||||
|
it 'should not redefine parts already defined' |
||||||
|
call airline#parts#define_raw('linenr', 'bar') |
||||||
|
call airline#init#sections() |
||||||
|
Expect g:airline_section_z =~ 'bar' |
||||||
|
end |
||||||
|
end |
||||||
|
|
@ -0,0 +1,39 @@ |
|||||||
|
describe 'parts' |
||||||
|
it 'overwrites existing values' |
||||||
|
call airline#parts#define('foo', { 'test': '123' }) |
||||||
|
Expect airline#parts#get('foo').test == '123' |
||||||
|
call airline#parts#define('foo', { 'test': '321' }) |
||||||
|
Expect airline#parts#get('foo').test == '321' |
||||||
|
end |
||||||
|
|
||||||
|
it 'can define a function part' |
||||||
|
call airline#parts#define_function('func', 'bar') |
||||||
|
Expect airline#parts#get('func').function == 'bar' |
||||||
|
end |
||||||
|
|
||||||
|
it 'can define a text part' |
||||||
|
call airline#parts#define_text('text', 'bar') |
||||||
|
Expect airline#parts#get('text').text == 'bar' |
||||||
|
end |
||||||
|
|
||||||
|
it 'can define a raw part' |
||||||
|
call airline#parts#define_raw('raw', 'bar') |
||||||
|
Expect airline#parts#get('raw').raw == 'bar' |
||||||
|
end |
||||||
|
|
||||||
|
it 'can define a minwidth' |
||||||
|
call airline#parts#define_minwidth('mw', 123) |
||||||
|
Expect airline#parts#get('mw').minwidth == 123 |
||||||
|
end |
||||||
|
|
||||||
|
it 'can define a condition' |
||||||
|
call airline#parts#define_condition('part', '1') |
||||||
|
Expect airline#parts#get('part').condition == '1' |
||||||
|
end |
||||||
|
|
||||||
|
it 'can define a accent' |
||||||
|
call airline#parts#define_accent('part', 'red') |
||||||
|
Expect airline#parts#get('part').accent == 'red' |
||||||
|
end |
||||||
|
end |
||||||
|
|
@ -0,0 +1,76 @@ |
|||||||
|
function! SectionSpec() |
||||||
|
endfunction |
||||||
|
|
||||||
|
describe 'section' |
||||||
|
before |
||||||
|
call airline#parts#define_text('text', 'text') |
||||||
|
call airline#parts#define_raw('raw', 'raw') |
||||||
|
call airline#parts#define_function('func', 'SectionSpec') |
||||||
|
end |
||||||
|
|
||||||
|
it 'should be able to reference default parts' |
||||||
|
let s = airline#section#create(['paste']) |
||||||
|
Expect s == '%{airline#util#wrap(airline#parts#paste(),0)}' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should create sections with no separators' |
||||||
|
let s = airline#section#create(['text', 'raw', 'func']) |
||||||
|
Expect s == '%{airline#util#wrap("text",0)}raw%{airline#util#wrap(SectionSpec(),0)}' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should create left sections with separators' |
||||||
|
let s = airline#section#create_left(['text', 'text']) |
||||||
|
Expect s == '%{airline#util#wrap("text",0)}%{airline#util#append("text",0)}' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should create right sections with separators' |
||||||
|
let s = airline#section#create_right(['text', 'text']) |
||||||
|
Expect s == '%{airline#util#prepend("text",0)}%{airline#util#wrap("text",0)}' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should prefix with accent group if provided and restore afterwards' |
||||||
|
call airline#parts#define('hi', { |
||||||
|
\ 'raw': 'hello', |
||||||
|
\ 'accent': 'red', |
||||||
|
\ }) |
||||||
|
let s = airline#section#create(['hi']) |
||||||
|
Expect s == '%#__accent_red#hello%#__restore__#' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should accent functions' |
||||||
|
call airline#parts#define_function('hi', 'Hello') |
||||||
|
call airline#parts#define_accent('hi', 'bold') |
||||||
|
let s = airline#section#create(['hi']) |
||||||
|
Expect s == '%#__accent_bold#%{airline#util#wrap(Hello(),0)}%#__restore__#' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should parse out a section from the distro' |
||||||
|
call airline#extensions#load() |
||||||
|
let s = airline#section#create(['whitespace']) |
||||||
|
Expect s =~ 'airline#extensions#whitespace#check' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should use parts as is if they are not found' |
||||||
|
let s = airline#section#create(['asdf', 'func']) |
||||||
|
Expect s == 'asdf%{airline#util#wrap(SectionSpec(),0)}' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should force add separators for raw and missing keys' |
||||||
|
let s = airline#section#create_left(['asdf', 'raw']) |
||||||
|
Expect s == 'asdf > raw' |
||||||
|
let s = airline#section#create_left(['asdf', 'aaaa', 'raw']) |
||||||
|
Expect s == 'asdf > aaaa > raw' |
||||||
|
let s = airline#section#create_right(['raw', '%f']) |
||||||
|
Expect s == 'raw < %f' |
||||||
|
let s = airline#section#create_right(['%t', 'asdf', '%{getcwd()}']) |
||||||
|
Expect s == '%t < asdf < %{getcwd()}' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should empty out parts that do not pass their condition' |
||||||
|
call airline#parts#define_text('conditional', 'conditional') |
||||||
|
call airline#parts#define_condition('conditional', '0') |
||||||
|
let s = airline#section#create(['conditional']) |
||||||
|
Expect s == '%{0 ? airline#util#wrap("conditional",0) : ""}' |
||||||
|
end |
||||||
|
end |
||||||
|
|
@ -0,0 +1,68 @@ |
|||||||
|
describe 'themes' |
||||||
|
after |
||||||
|
highlight clear Foo |
||||||
|
highlight clear Normal |
||||||
|
end |
||||||
|
|
||||||
|
it 'should extract correct colors' |
||||||
|
highlight Foo ctermfg=1 ctermbg=2 |
||||||
|
let colors = airline#themes#get_highlight('Foo') |
||||||
|
Expect colors[2] == '1' |
||||||
|
Expect colors[3] == '2' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should extract from normal if colors unavailable' |
||||||
|
highlight Normal ctermfg=100 ctermbg=200 |
||||||
|
highlight Foo ctermbg=2 |
||||||
|
let colors = airline#themes#get_highlight('Foo') |
||||||
|
Expect colors[2] == '100' |
||||||
|
Expect colors[3] == '2' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should flip target group if it is reversed' |
||||||
|
highlight Foo ctermbg=222 ctermfg=103 term=reverse |
||||||
|
let colors = airline#themes#get_highlight('Foo') |
||||||
|
Expect colors[2] == '222' |
||||||
|
Expect colors[3] == '103' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should pass args through correctly' |
||||||
|
let hl = airline#themes#get_highlight('Foo', 'bold', 'italic') |
||||||
|
Expect hl == ['', '', 0, 1, 'bold,italic'] |
||||||
|
|
||||||
|
let hl = airline#themes#get_highlight2(['Foo','bg'], ['Foo','fg'], 'italic', 'bold') |
||||||
|
Expect hl == ['', '', 1, 0, 'italic,bold'] |
||||||
|
end |
||||||
|
|
||||||
|
it 'should generate color map with mirroring' |
||||||
|
let map = airline#themes#generate_color_map( |
||||||
|
\ [ 1, 1, 1, 1, '1' ], |
||||||
|
\ [ 2, 2, 2, 2, '2' ], |
||||||
|
\ [ 3, 3, 3, 3, '3' ], |
||||||
|
\ ) |
||||||
|
Expect map.airline_a[0] == 1 |
||||||
|
Expect map.airline_b[0] == 2 |
||||||
|
Expect map.airline_c[0] == 3 |
||||||
|
Expect map.airline_x[0] == 3 |
||||||
|
Expect map.airline_y[0] == 2 |
||||||
|
Expect map.airline_z[0] == 1 |
||||||
|
end |
||||||
|
|
||||||
|
it 'should generate color map with full set of colors' |
||||||
|
let map = airline#themes#generate_color_map( |
||||||
|
\ [ 1, 1, 1, 1, '1' ], |
||||||
|
\ [ 2, 2, 2, 2, '2' ], |
||||||
|
\ [ 3, 3, 3, 3, '3' ], |
||||||
|
\ [ 4, 4, 4, 4, '4' ], |
||||||
|
\ [ 5, 5, 5, 5, '5' ], |
||||||
|
\ [ 6, 6, 6, 6, '6' ], |
||||||
|
\ ) |
||||||
|
Expect map.airline_a[0] == 1 |
||||||
|
Expect map.airline_b[0] == 2 |
||||||
|
Expect map.airline_c[0] == 3 |
||||||
|
Expect map.airline_x[0] == 4 |
||||||
|
Expect map.airline_y[0] == 5 |
||||||
|
Expect map.airline_z[0] == 6 |
||||||
|
end |
||||||
|
end |
||||||
|
|
@ -0,0 +1,54 @@ |
|||||||
|
call airline#init#bootstrap() |
||||||
|
|
||||||
|
function! Util1() |
||||||
|
let g:count += 1 |
||||||
|
endfunction |
||||||
|
function! Util2() |
||||||
|
let g:count += 2 |
||||||
|
endfunction |
||||||
|
function! Util3(...) |
||||||
|
let g:count = a:0 |
||||||
|
endfunction |
||||||
|
|
||||||
|
describe 'util' |
||||||
|
before |
||||||
|
let g:count = 0 |
||||||
|
end |
||||||
|
|
||||||
|
it 'has append wrapper function' |
||||||
|
Expect airline#util#append('', 0) == '' |
||||||
|
Expect airline#util#append('1', 0) == ' > 1' |
||||||
|
end |
||||||
|
|
||||||
|
it 'has prepend wrapper function' |
||||||
|
Expect airline#util#prepend('', 0) == '' |
||||||
|
Expect airline#util#prepend('1', 0) == '1 < ' |
||||||
|
end |
||||||
|
|
||||||
|
it 'has getwinvar function' |
||||||
|
Expect airline#util#getwinvar(1, 'asdf', '123') == '123' |
||||||
|
call setwinvar(1, 'vspec', 'is cool') |
||||||
|
Expect airline#util#getwinvar(1, 'vspec', '') == 'is cool' |
||||||
|
end |
||||||
|
|
||||||
|
it 'has exec funcrefs helper functions' |
||||||
|
call airline#util#exec_funcrefs([function('Util1'), function('Util2')]) |
||||||
|
Expect g:count == 3 |
||||||
|
|
||||||
|
call airline#util#exec_funcrefs([function('Util3')], 1, 2, 3, 4) |
||||||
|
Expect g:count == 4 |
||||||
|
end |
||||||
|
|
||||||
|
it 'should ignore minwidth if less than 0' |
||||||
|
Expect airline#util#append('foo', -1) == ' > foo' |
||||||
|
Expect airline#util#prepend('foo', -1) == 'foo < ' |
||||||
|
Expect airline#util#wrap('foo', -1) == 'foo' |
||||||
|
end |
||||||
|
|
||||||
|
it 'should return empty if winwidth() > minwidth' |
||||||
|
Expect airline#util#append('foo', 99999) == '' |
||||||
|
Expect airline#util#prepend('foo', 99999) == '' |
||||||
|
Expect airline#util#wrap('foo', 99999) == '' |
||||||
|
end |
||||||
|
end |
||||||
|
|
Loading…
Reference in new issue