mirror of
https://github.com/amix/vimrc
synced 2025-06-29 11:04:59 +08:00
Updated vim plugins
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 2013-2014 Bailey Ling
|
||||
Copyright (C) 2013-2015 Bailey Ling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the "Software"),
|
||||
|
@ -178,7 +178,7 @@ Contributions and pull requests are welcome. Please take note of the following
|
||||
|
||||
# License
|
||||
|
||||
MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
|
||||
|
||||
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let g:airline_statusline_funcrefs = get(g:, 'airline_statusline_funcrefs', [])
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:prototype = {}
|
||||
@ -77,7 +77,7 @@ function! s:should_change_group(group1, group2)
|
||||
endif
|
||||
let color1 = airline#highlighter#get_highlight(a:group1)
|
||||
let color2 = airline#highlighter#get_highlight(a:group2)
|
||||
if has('gui_running')
|
||||
if has('gui_running') || (has("termtruecolor") && &guicolors == 1)
|
||||
return color1[1] != color2[1] || color1[0] != color2[0]
|
||||
else
|
||||
return color1[3] != color2[3] || color1[2] != color2[2]
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
function! airline#debug#profile1()
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
function! airline#deprecation#check()
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:ext = {}
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:has_fugitive = exists('*fugitive#head')
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !exists('*bufferline#get_status_string')
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !get(g:, 'command_t_loaded', 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !get(g:, 'loaded_csv', 0) && !exists(':Table')
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !get(g:, 'loaded_ctrlp', 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', {
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !exists(':ProjectCreate')
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" we don't actually want this loaded :P
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !exists(':NetrwSettings')
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !get(g:, 'loaded_nrrw_rgn', 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !exists(':PromptlineSnapshot')
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let g:airline#extensions#quickfix#quickfix_text = 'Quickfix'
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !exists(':SyntasticCheck')
|
||||
|
@ -1,36 +1,9 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
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:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
|
||||
let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
|
||||
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
||||
let s:show_close_button = get(g:, 'airline#extensions#tabline#show_close_button', 1)
|
||||
let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X')
|
||||
let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
|
||||
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)
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
let s:number_map = &encoding == 'utf-8'
|
||||
\ ? {
|
||||
\ '0': '⁰',
|
||||
\ '1': '¹',
|
||||
\ '2': '²',
|
||||
\ '3': '³',
|
||||
\ '4': '⁴',
|
||||
\ '5': '⁵',
|
||||
\ '6': '⁶',
|
||||
\ '7': '⁷',
|
||||
\ '8': '⁸',
|
||||
\ '9': '⁹'
|
||||
\ }
|
||||
\ : {}
|
||||
|
||||
function! airline#extensions#tabline#init(ext)
|
||||
if has('gui_running')
|
||||
@ -39,42 +12,23 @@ function! airline#extensions#tabline#init(ext)
|
||||
|
||||
autocmd User AirlineToggledOn call s:toggle_on()
|
||||
autocmd User AirlineToggledOff call s:toggle_off()
|
||||
autocmd BufDelete * let s:current_bufnr = -1
|
||||
|
||||
call s:toggle_on()
|
||||
call a:ext.add_theme_func('airline#extensions#tabline#load_theme')
|
||||
if s:buffer_idx_mode
|
||||
call s:define_buffer_idx_mode_mappings()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:toggle_off()
|
||||
if exists('s:original_tabline')
|
||||
let &tabline = s:original_tabline
|
||||
let &showtabline = s:original_showtabline
|
||||
endif
|
||||
call airline#extensions#tabline#autoshow#off()
|
||||
call airline#extensions#tabline#tabs#off()
|
||||
call airline#extensions#tabline#buffers#off()
|
||||
endfunction
|
||||
|
||||
function! s:toggle_on()
|
||||
let [ s:original_tabline, s:original_showtabline ] = [ &tabline, &showtabline ]
|
||||
call airline#extensions#tabline#autoshow#on()
|
||||
call airline#extensions#tabline#tabs#on()
|
||||
call airline#extensions#tabline#buffers#on()
|
||||
|
||||
set tabline=%!airline#extensions#tabline#get()
|
||||
augroup airline_tabline
|
||||
autocmd!
|
||||
" Invalidate cache.
|
||||
autocmd BufAdd,BufUnload * unlet! s:current_buffer_list
|
||||
|
||||
if s:buf_min_count <= 0 && s:tab_min_count <= 1
|
||||
set showtabline=2
|
||||
else
|
||||
if s:show_buffers == 1
|
||||
autocmd BufEnter * call <sid>show_tabline(s:buf_min_count, len(s:get_buffer_list()))
|
||||
autocmd BufUnload * call <sid>show_tabline(s:buf_min_count, len(s:get_buffer_list()) - 1)
|
||||
else
|
||||
autocmd TabEnter * call <sid>show_tabline(s:tab_min_count, tabpagenr('$'))
|
||||
endif
|
||||
endif
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#load_theme(palette)
|
||||
@ -101,28 +55,19 @@ function! airline#extensions#tabline#load_theme(palette)
|
||||
call airline#highlighter#exec('airline_tabhid', l:tabhid)
|
||||
endfunction
|
||||
|
||||
function! s:show_tabline(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
|
||||
|
||||
let s:current_tabcnt = -1
|
||||
function! airline#extensions#tabline#get()
|
||||
let curtabcnt = tabpagenr('$')
|
||||
if curtabcnt != s:current_tabcnt
|
||||
let s:current_tabcnt = curtabcnt
|
||||
let s:current_bufnr = -1 " force a refresh...
|
||||
call airline#extensions#tabline#tabs#invalidate()
|
||||
call airline#extensions#tabline#buffers#invalidate()
|
||||
endif
|
||||
|
||||
if s:show_buffers && curtabcnt == 1 || !s:show_tabs
|
||||
return s:get_buffers()
|
||||
return airline#extensions#tabline#buffers#get()
|
||||
else
|
||||
return s:get_tabs()
|
||||
return airline#extensions#tabline#tabs#get()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@ -133,182 +78,10 @@ function! airline#extensions#tabline#title(n)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#get_buffer_name(nr)
|
||||
return airline#extensions#tabline#{s:formatter}#format(a:nr, s:get_buffer_list())
|
||||
return airline#extensions#tabline#formatters#{s:formatter}#format(a:nr, airline#extensions#tabline#buflist#list())
|
||||
endfunction
|
||||
|
||||
function! s:get_buffer_list()
|
||||
if exists('s:current_buffer_list')
|
||||
return s:current_buffer_list
|
||||
endif
|
||||
|
||||
let buffers = []
|
||||
let cur = bufnr('%')
|
||||
for nr in range(1, bufnr('$'))
|
||||
if buflisted(nr) && bufexists(nr)
|
||||
let toadd = 1
|
||||
for ex in s:excludes
|
||||
if match(bufname(nr), ex) >= 0
|
||||
let toadd = 0
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
if getbufvar(nr, 'current_syntax') == 'qf'
|
||||
let toadd = 0
|
||||
endif
|
||||
if toadd
|
||||
call add(buffers, nr)
|
||||
endif
|
||||
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
|
||||
|
||||
let g:current_visible_buffers = buffers
|
||||
return buffers
|
||||
endfunction
|
||||
|
||||
let s:current_bufnr = -1
|
||||
let s:current_tabnr = -1
|
||||
let s:current_tabcnt = -1
|
||||
let s:current_tabline = ''
|
||||
let s:current_modified = 0
|
||||
function! s:get_buffers()
|
||||
let cur = bufnr('%')
|
||||
if cur == s:current_bufnr
|
||||
if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified
|
||||
return s:current_tabline
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:index = 1
|
||||
let b = s:new_builder()
|
||||
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
|
||||
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0
|
||||
else
|
||||
if g:airline_detect_modified && getbufvar(nr, '&modified')
|
||||
let group = 'airline_tabmod_unsel'
|
||||
elseif index(tab_bufs, nr) > -1
|
||||
let group = 'airline_tab'
|
||||
else
|
||||
let group = 'airline_tabhid'
|
||||
endif
|
||||
endif
|
||||
|
||||
if s:buffer_idx_mode
|
||||
if len(s:number_map) > 0
|
||||
call b.add_section(group, s:spc . get(s:number_map, l:index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc)
|
||||
else
|
||||
call b.add_section(group, '['.l:index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']')
|
||||
endif
|
||||
let l:index = l:index + 1
|
||||
else
|
||||
call b.add_section(group, s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc)
|
||||
endif
|
||||
endfor
|
||||
|
||||
call b.add_section('airline_tabfill', '')
|
||||
call b.split()
|
||||
call b.add_section('airline_tabfill', '')
|
||||
call b.add_section('airline_tabtype', ' buffers ')
|
||||
|
||||
let s:current_bufnr = cur
|
||||
let s:current_tabline = b.build()
|
||||
return s:current_tabline
|
||||
endfunction
|
||||
|
||||
function! s:select_tab(buf_index)
|
||||
" no-op when called in the NERDTree buffer
|
||||
if exists('t:NERDTreeBufName') && bufname('%') == t:NERDTreeBufName
|
||||
return
|
||||
endif
|
||||
|
||||
let idx = a:buf_index
|
||||
if g:current_visible_buffers[0] == -1
|
||||
let idx = idx + 1
|
||||
endif
|
||||
|
||||
let buf = get(g:current_visible_buffers, idx, 0)
|
||||
if buf != 0
|
||||
exec 'b!' . buf
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:define_buffer_idx_mode_mappings()
|
||||
noremap <unique> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab3 :call <SID>select_tab(2)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab4 :call <SID>select_tab(3)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab5 :call <SID>select_tab(4)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab6 :call <SID>select_tab(5)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab7 :call <SID>select_tab(6)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab8 :call <SID>select_tab(7)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab9 :call <SID>select_tab(8)<CR>
|
||||
endfunction
|
||||
|
||||
function! s:new_builder()
|
||||
function! airline#extensions#tabline#new_builder()
|
||||
let builder_context = {
|
||||
\ 'active' : 1,
|
||||
\ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep),
|
||||
@ -324,54 +97,3 @@ function! s:new_builder()
|
||||
|
||||
return airline#builder#new(builder_context)
|
||||
endfunction
|
||||
|
||||
function! s:get_tabs()
|
||||
let curbuf = bufnr('%')
|
||||
let curtab = tabpagenr()
|
||||
if curbuf == s:current_bufnr && curtab == s:current_tabnr
|
||||
if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified
|
||||
return s:current_tabline
|
||||
endif
|
||||
endif
|
||||
|
||||
let b = s:new_builder()
|
||||
for i in range(1, tabpagenr('$'))
|
||||
if i == curtab
|
||||
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
|
||||
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0
|
||||
else
|
||||
let group = 'airline_tab'
|
||||
endif
|
||||
let val = '%('
|
||||
if s:show_tab_nr
|
||||
if s:tab_nr_type == 0
|
||||
let val .= ' %{len(tabpagebuflist('.i.'))}'
|
||||
else
|
||||
let val .= (g:airline_symbols.space).i
|
||||
endif
|
||||
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()
|
||||
if s:show_close_button
|
||||
call b.add_section('airline_tab', ' %999X'.s:close_symbol.' ')
|
||||
endif
|
||||
if s:show_tab_type
|
||||
call b.add_section('airline_tabtype', ' tabs ')
|
||||
endif
|
||||
|
||||
let s:current_bufnr = curbuf
|
||||
let s:current_tabnr = curtab
|
||||
let s:current_tabline = b.build()
|
||||
return s:current_tabline
|
||||
endfunction
|
||||
|
@ -0,0 +1,51 @@
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
||||
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#autoshow#off()
|
||||
if exists('s:original_tabline')
|
||||
let &tabline = s:original_tabline
|
||||
let &showtabline = s:original_showtabline
|
||||
endif
|
||||
|
||||
augroup airline_tabline_autoshow
|
||||
autocmd!
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#autoshow#on()
|
||||
let [ s:original_tabline, s:original_showtabline ] = [ &tabline, &showtabline ]
|
||||
|
||||
augroup airline_tabline_autoshow
|
||||
autocmd!
|
||||
if s:buf_min_count <= 0 && s:tab_min_count <= 1
|
||||
set showtabline=2
|
||||
else
|
||||
if s:show_buffers == 1
|
||||
autocmd BufEnter * call <sid>show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list()))
|
||||
autocmd BufUnload * call <sid>show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list()) - 1)
|
||||
else
|
||||
autocmd TabEnter * call <sid>show_tabline(s:tab_min_count, tabpagenr('$'))
|
||||
endif
|
||||
endif
|
||||
|
||||
" Invalidate cache. This has to come after the BufUnload for
|
||||
" s:show_buffers, to invalidate the cache for BufEnter.
|
||||
autocmd BufAdd,BufUnload * call airline#extensions#tabline#buflist#invalidate()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! s:show_tabline(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
|
@ -0,0 +1,185 @@
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
|
||||
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
let s:current_bufnr = -1
|
||||
let s:current_modified = 0
|
||||
let s:current_tabline = ''
|
||||
let s:current_visible_buffers = []
|
||||
|
||||
let s:number_map = &encoding == 'utf-8'
|
||||
\ ? {
|
||||
\ '0': '⁰',
|
||||
\ '1': '¹',
|
||||
\ '2': '²',
|
||||
\ '3': '³',
|
||||
\ '4': '⁴',
|
||||
\ '5': '⁵',
|
||||
\ '6': '⁶',
|
||||
\ '7': '⁷',
|
||||
\ '8': '⁸',
|
||||
\ '9': '⁹'
|
||||
\ }
|
||||
\ : {}
|
||||
|
||||
function! airline#extensions#tabline#buffers#off()
|
||||
augroup airline_tabline_buffers
|
||||
autocmd!
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#buffers#on()
|
||||
augroup airline_tabline_buffers
|
||||
autocmd!
|
||||
autocmd BufDelete * call airline#extensions#tabline#buffers#invalidate()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#buffers#invalidate()
|
||||
let s:current_bufnr = -1
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#buffers#get()
|
||||
let cur = bufnr('%')
|
||||
if cur == s:current_bufnr
|
||||
if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified
|
||||
return s:current_tabline
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:index = 1
|
||||
let b = airline#extensions#tabline#new_builder()
|
||||
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
|
||||
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0
|
||||
else
|
||||
if g:airline_detect_modified && getbufvar(nr, '&modified')
|
||||
let group = 'airline_tabmod_unsel'
|
||||
elseif index(tab_bufs, nr) > -1
|
||||
let group = 'airline_tab'
|
||||
else
|
||||
let group = 'airline_tabhid'
|
||||
endif
|
||||
endif
|
||||
|
||||
if s:buffer_idx_mode
|
||||
if len(s:number_map) > 0
|
||||
call b.add_section(group, s:spc . get(s:number_map, l:index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc)
|
||||
else
|
||||
call b.add_section(group, '['.l:index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']')
|
||||
endif
|
||||
let l:index = l:index + 1
|
||||
else
|
||||
call b.add_section(group, s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc)
|
||||
endif
|
||||
endfor
|
||||
|
||||
call b.add_section('airline_tabfill', '')
|
||||
call b.split()
|
||||
call b.add_section('airline_tabfill', '')
|
||||
if s:show_tab_type
|
||||
call b.add_section('airline_tabtype', ' buffers ')
|
||||
endif
|
||||
|
||||
let s:current_bufnr = cur
|
||||
let s:current_tabline = b.build()
|
||||
return s:current_tabline
|
||||
endfunction
|
||||
|
||||
function! s:get_visible_buffers()
|
||||
let buffers = airline#extensions#tabline#buflist#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
|
||||
|
||||
let s:current_visible_buffers = buffers
|
||||
return buffers
|
||||
endfunction
|
||||
|
||||
function! s:select_tab(buf_index)
|
||||
" no-op when called in the NERDTree buffer
|
||||
if exists('t:NERDTreeBufName') && bufname('%') == t:NERDTreeBufName
|
||||
return
|
||||
endif
|
||||
|
||||
let idx = a:buf_index
|
||||
if s:current_visible_buffers[0] == -1
|
||||
let idx = idx + 1
|
||||
endif
|
||||
|
||||
let buf = get(s:current_visible_buffers, idx, 0)
|
||||
if buf != 0
|
||||
exec 'b!' . buf
|
||||
endif
|
||||
endfunction
|
||||
|
||||
if s:buffer_idx_mode
|
||||
noremap <unique> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab3 :call <SID>select_tab(2)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab4 :call <SID>select_tab(3)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab5 :call <SID>select_tab(4)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab6 :call <SID>select_tab(5)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab7 :call <SID>select_tab(6)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab8 :call <SID>select_tab(7)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectTab9 :call <SID>select_tab(8)<CR>
|
||||
endif
|
@ -0,0 +1,38 @@
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:excludes = get(g:, 'airline#extensions#tabline#excludes', [])
|
||||
|
||||
function! airline#extensions#tabline#buflist#invalidate()
|
||||
unlet! s:current_buffer_list
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#buflist#list()
|
||||
if exists('s:current_buffer_list')
|
||||
return s:current_buffer_list
|
||||
endif
|
||||
|
||||
let buffers = []
|
||||
let cur = bufnr('%')
|
||||
for nr in range(1, bufnr('$'))
|
||||
if buflisted(nr) && bufexists(nr)
|
||||
let toadd = 1
|
||||
for ex in s:excludes
|
||||
if match(bufname(nr), ex) >= 0
|
||||
let toadd = 0
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
if getbufvar(nr, 'current_syntax') == 'qf'
|
||||
let toadd = 0
|
||||
endif
|
||||
if toadd
|
||||
call add(buffers, nr)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
let s:current_buffer_list = buffers
|
||||
return buffers
|
||||
endfunction
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
|
||||
@ -7,7 +7,7 @@ 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#default#format(bufnr, buffers)
|
||||
function! airline#extensions#tabline#formatters#default#format(bufnr, buffers)
|
||||
let _ = ''
|
||||
|
||||
let name = bufname(a:bufnr)
|
||||
@ -21,10 +21,10 @@ function! airline#extensions#tabline#default#format(bufnr, buffers)
|
||||
endif
|
||||
endif
|
||||
|
||||
return airline#extensions#tabline#default#wrap_name(a:bufnr, _)
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#default#wrap_name(bufnr, buffer_name)
|
||||
function! airline#extensions#tabline#formatters#default#wrap_name(bufnr, buffer_name)
|
||||
let _ = s:buf_nr_show ? printf(s:buf_nr_format, a:bufnr) : ''
|
||||
let _ .= substitute(a:buffer_name, '\\', '/', 'g')
|
||||
|
@ -1,7 +1,7 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
function! airline#extensions#tabline#unique_tail#format(bufnr, buffers)
|
||||
function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffers)
|
||||
let duplicates = {}
|
||||
let tails = {}
|
||||
let map = {}
|
||||
@ -15,12 +15,12 @@ function! airline#extensions#tabline#unique_tail#format(bufnr, buffers)
|
||||
let duplicates[nr] = nr
|
||||
endif
|
||||
let tails[tail] = 1
|
||||
let map[nr] = airline#extensions#tabline#default#wrap_name(nr, tail)
|
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, tail)
|
||||
endif
|
||||
endfor
|
||||
|
||||
for nr in values(duplicates)
|
||||
let map[nr] = airline#extensions#tabline#default#wrap_name(nr, fnamemodify(bufname(nr), ':p:.'))
|
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(bufname(nr), ':p:.'))
|
||||
endfor
|
||||
|
||||
return map[a:bufnr]
|
@ -1,13 +1,13 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:skip_symbol = '…'
|
||||
|
||||
function! airline#extensions#tabline#unique_tail_improved#format(bufnr, buffers)
|
||||
function! airline#extensions#tabline#formatters#unique_tail_improved#format(bufnr, buffers)
|
||||
if len(a:buffers) <= 1 " don't need to compare bufnames if has less than one buffer opened
|
||||
return airline#extensions#tabline#default#format(a:bufnr, a:buffers)
|
||||
return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers)
|
||||
endif
|
||||
|
||||
let curbuf_tail = fnamemodify(bufname(a:bufnr), ':t')
|
||||
@ -84,8 +84,8 @@ function! airline#extensions#tabline#unique_tail_improved#format(bufnr, buffers)
|
||||
call insert(buf_name, s:skip_symbol)
|
||||
endif
|
||||
|
||||
return airline#extensions#tabline#default#wrap_name(a:bufnr, join(buf_name, '/'))
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, join(buf_name, '/'))
|
||||
else
|
||||
return airline#extensions#tabline#default#format(a:bufnr, a:buffers)
|
||||
return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers)
|
||||
endif
|
||||
endfunction
|
@ -0,0 +1,80 @@
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
|
||||
let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
|
||||
let s:show_close_button = get(g:, 'airline#extensions#tabline#show_close_button', 1)
|
||||
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
||||
let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X')
|
||||
|
||||
let s:current_bufnr = -1
|
||||
let s:current_tabnr = -1
|
||||
let s:current_modified = 0
|
||||
|
||||
function! airline#extensions#tabline#tabs#off()
|
||||
augroup airline_tabline_tabs
|
||||
autocmd!
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#on()
|
||||
augroup airline_tabline_tabs
|
||||
autocmd!
|
||||
autocmd BufDelete * call airline#extensions#tabline#tabs#invalidate()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#invalidate()
|
||||
let s:current_bufnr = -1
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#get()
|
||||
let curbuf = bufnr('%')
|
||||
let curtab = tabpagenr()
|
||||
if curbuf == s:current_bufnr && curtab == s:current_tabnr
|
||||
if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified
|
||||
return s:current_tabline
|
||||
endif
|
||||
endif
|
||||
|
||||
let b = airline#extensions#tabline#new_builder()
|
||||
for i in range(1, tabpagenr('$'))
|
||||
if i == curtab
|
||||
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
|
||||
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0
|
||||
else
|
||||
let group = 'airline_tab'
|
||||
endif
|
||||
let val = '%('
|
||||
if s:show_tab_nr
|
||||
if s:tab_nr_type == 0
|
||||
let val .= ' %{len(tabpagebuflist('.i.'))}'
|
||||
else
|
||||
let val .= (g:airline_symbols.space).i
|
||||
endif
|
||||
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()
|
||||
if s:show_close_button
|
||||
call b.add_section('airline_tab', ' %999X'.s:close_symbol.' ')
|
||||
endif
|
||||
if s:show_tab_type
|
||||
call b.add_section('airline_tabtype', ' tabs ')
|
||||
endif
|
||||
|
||||
let s:current_bufnr = curbuf
|
||||
let s:current_tabnr = curtab
|
||||
let s:current_tabline = b.build()
|
||||
return s:current_tabline
|
||||
endfunction
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !exists(':TagbarToggle')
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !exists(':Tmuxline')
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !exists(':UndotreeToggle')
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !get(g:, 'loaded_unite', 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !isdirectory($VIRTUAL_ENV)
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:is_win32term = (has('win32') || has('win64')) && !has('gui_running')
|
||||
@ -16,13 +16,13 @@ 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 mode = has('gui_running') || (has("termtruecolor") && &guicolors == 1) ? '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')
|
||||
if has('gui_running') || (has("termtruecolor") && &guicolors == 1)
|
||||
let color = a:what ==# 'fg' ? '#000000' : '#FFFFFF'
|
||||
else
|
||||
let color = a:what ==# 'fg' ? 0 : 1
|
||||
@ -34,7 +34,7 @@ endfunction
|
||||
function! s:get_array(fg, bg, opts)
|
||||
let fg = a:fg
|
||||
let bg = a:bg
|
||||
return has('gui_running')
|
||||
return has('gui_running') || (has("termtruecolor") && &guicolors == 1)
|
||||
\ ? [ fg, bg, '', '', join(a:opts, ',') ]
|
||||
\ : [ '', '', fg, bg, join(a:opts, ',') ]
|
||||
endfunction
|
||||
@ -42,7 +42,7 @@ 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 = has('gui_running')
|
||||
let reverse = has('gui_running') || (has("termtruecolor") && &guicolors == 1)
|
||||
\ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui')
|
||||
\ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm')
|
||||
\|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'term')
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
function! s:check_defined(variable, default)
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:parts = {}
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
call airline#init#bootstrap()
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" generates a dictionary which defines the colors for each highlight group
|
||||
|
@ -15,7 +15,7 @@ let s:V4 = [ '#c7915b' , 173 ] " coffee
|
||||
let s:PA = [ '#f4cf86' , 222 ] " dirtyblonde
|
||||
let s:RE = [ '#ff9eb8' , 211 ] " dress
|
||||
|
||||
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ]
|
||||
let s:IA = [ s:N3[1] , s:N2[1] , s:N3[3] , s:N2[3] , '' ]
|
||||
|
||||
let g:airline#themes#badwolf#palette = {}
|
||||
|
||||
|
@ -69,7 +69,7 @@ else
|
||||
\ }
|
||||
|
||||
let s:N1 = airline#themes#get_highlight2(['DiffText', 'bg'], ['DiffText', 'fg'], 'bold')
|
||||
let s:N2 = airline#themes#get_highlight('Visual')
|
||||
let s:N2 = airline#themes#get_highlight2(['Visual', 'fg'], ['Visual', 'bg'])
|
||||
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)
|
||||
|
||||
@ -78,19 +78,19 @@ else
|
||||
\ 'statusline': [ group[0], '', group[2], '', '' ]
|
||||
\ }
|
||||
|
||||
let s:I1 = airline#themes#get_highlight2(['DiffAdded', 'bg'], ['DiffAdded', 'fg'], 'bold')
|
||||
let s:I1 = airline#themes#get_highlight2(['DiffText', '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:R1 = airline#themes#get_highlight2(['DiffText', '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:V1 = airline#themes#get_highlight2(['DiffText', '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)
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
call airline#init#bootstrap()
|
||||
|
@ -14,16 +14,17 @@ CONTENTS *airline-contents*
|
||||
03. Name ................................................. |airline-name|
|
||||
04. Configuration ............................... |airline-configuration|
|
||||
05. Commands ......................................... |airline-commands|
|
||||
06. Customization ............................... |airline-customization|
|
||||
07. Extensions ..................................... |airline-extensions|
|
||||
08. Advanced Customization ............. |airline-advanced-customization|
|
||||
09. Funcrefs ......................................... |airline-funcrefs|
|
||||
10. Pipeline ......................................... |airline-pipeline|
|
||||
11. Writing Extensions ..................... |airline-writing-extensions|
|
||||
12. Writing Themes ..................................... |airline-themes|
|
||||
13. Troubleshooting ........................... |airline-troubleshooting|
|
||||
14. Contributions ............................... |airline-contributions|
|
||||
15. License ........................................... |airline-license|
|
||||
06. Autocommands ................................. |airline-autocommands|
|
||||
07. Customization ............................... |airline-customization|
|
||||
08. Extensions ..................................... |airline-extensions|
|
||||
09. Advanced Customization ............. |airline-advanced-customization|
|
||||
10. Funcrefs ......................................... |airline-funcrefs|
|
||||
11. Pipeline ......................................... |airline-pipeline|
|
||||
12. Writing Extensions ..................... |airline-writing-extensions|
|
||||
13. Writing Themes ..................................... |airline-themes|
|
||||
14. Troubleshooting ........................... |airline-troubleshooting|
|
||||
15. Contributions ............................... |airline-contributions|
|
||||
16. License ........................................... |airline-license|
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *airline-intro*
|
||||
@ -146,6 +147,17 @@ COMMANDS *airline-commands*
|
||||
:AirlineRefresh *:AirlineRefresh*
|
||||
Refreshes all highlight groups and redraws the statusline.
|
||||
|
||||
==============================================================================
|
||||
AUTOCOMMANDS *airline-autocommands*
|
||||
|
||||
Airline comes with some user-defined autocommands.
|
||||
|
||||
|AirlineAfterInit| after plugin is initialized, but before the statusline
|
||||
is replaced
|
||||
|AirlineToggledOn| after airline is activated and replaced the statusline
|
||||
|AirlineToggledOff| after airline is deactivated and the statusline is
|
||||
restored to the original
|
||||
|
||||
==============================================================================
|
||||
CUSTOMIZATION *airline-customization*
|
||||
|
||||
@ -616,7 +628,7 @@ define a section like this: >
|
||||
let g:airline_section_b = airline#section#create_left(['ffenc','file'])
|
||||
let g:airline_section_c = airline#section#create(['%{getcwd()}'])
|
||||
endfunction
|
||||
autocmd VimEnter * call AirlineInit()
|
||||
autocmd User AirlineAfterInit call AirlineInit()
|
||||
<
|
||||
This will create a section with the `mode`, followed by a space, and our `foo`
|
||||
part in section `a`. Section `b` will have two parts with a left-side
|
||||
@ -795,7 +807,7 @@ Contributions and pull requests are welcome.
|
||||
==============================================================================
|
||||
LICENSE *airline-license*
|
||||
|
||||
MIT License. Copyright © 2013-2014 Bailey Ling.
|
||||
MIT License. Copyright © 2013-2015 Bailey Ling.
|
||||
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
@ -1,4 +1,4 @@
|
||||
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if &cp || v:version < 702 || (exists('g:loaded_airline') && g:loaded_airline)
|
||||
@ -6,36 +6,30 @@ if &cp || v:version < 702 || (exists('g:loaded_airline') && g:loaded_airline)
|
||||
endif
|
||||
let g:loaded_airline = 1
|
||||
|
||||
" autocmd VimEnter * call airline#deprecation#check()
|
||||
|
||||
let s:airline_initialized = 0
|
||||
let s:airline_theme_defined = 0
|
||||
function! s:init()
|
||||
if !s:airline_initialized
|
||||
let s:airline_initialized = 1
|
||||
call airline#init#bootstrap()
|
||||
call airline#extensions#load()
|
||||
call airline#init#sections()
|
||||
|
||||
call airline#init#bootstrap()
|
||||
call airline#extensions#load()
|
||||
call airline#init#sections()
|
||||
|
||||
let s:airline_theme_defined = exists('g:airline_theme')
|
||||
if s:airline_theme_defined || !airline#switch_matching_theme()
|
||||
let g:airline_theme = get(g:, 'airline_theme', 'dark')
|
||||
call airline#switch_theme(g:airline_theme)
|
||||
endif
|
||||
let s:airline_theme_defined = exists('g:airline_theme')
|
||||
if s:airline_theme_defined || !airline#switch_matching_theme()
|
||||
let g:airline_theme = get(g:, 'airline_theme', 'dark')
|
||||
call airline#switch_theme(g:airline_theme)
|
||||
endif
|
||||
|
||||
silent doautocmd User AirlineAfterInit
|
||||
call s:airline_toggle()
|
||||
endfunction
|
||||
|
||||
function! s:on_window_changed()
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
call <sid>init()
|
||||
call airline#update_statusline()
|
||||
endfunction
|
||||
|
||||
function! s:on_colorscheme_changed()
|
||||
call <sid>init()
|
||||
if !s:airline_theme_defined
|
||||
if airline#switch_matching_theme()
|
||||
return
|
||||
@ -81,11 +75,8 @@ function! s:airline_toggle()
|
||||
\ | call airline#load_theme()
|
||||
augroup END
|
||||
|
||||
call <sid>on_window_changed()
|
||||
silent doautocmd User AirlineToggledOn
|
||||
|
||||
if s:airline_initialized
|
||||
call <sid>on_window_changed()
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@ -93,6 +84,7 @@ function! s:get_airline_themes(a, l, p)
|
||||
let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:a.'*'), "\n")
|
||||
return map(files, 'fnamemodify(v:val, ":t:r")')
|
||||
endfunction
|
||||
|
||||
function! s:airline_theme(...)
|
||||
if a:0
|
||||
call airline#switch_theme(a:1)
|
||||
@ -100,10 +92,12 @@ function! s:airline_theme(...)
|
||||
echo g:airline_theme
|
||||
endif
|
||||
endfunction
|
||||
|
||||
command! -nargs=? -complete=customlist,<sid>get_airline_themes AirlineTheme call <sid>airline_theme(<f-args>)
|
||||
command! AirlineToggleWhitespace call airline#extensions#whitespace#toggle()
|
||||
command! AirlineToggle call <sid>airline_toggle()
|
||||
command! AirlineRefresh call airline#load_theme() | call airline#update_statusline()
|
||||
|
||||
call <sid>airline_toggle()
|
||||
autocmd VimEnter * call airline#deprecation#check()
|
||||
autocmd VimEnter * call s:init()
|
||||
|
||||
|
Reference in New Issue
Block a user