mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -9,6 +9,21 @@ if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:head_format = get(g:, 'airline#extensions#branch#format', 0)
|
||||
if s:head_format == 1
|
||||
function! s:format_name(name)
|
||||
return fnamemodify(a:name, ':t')
|
||||
endfunction
|
||||
elseif type(s:head_format) == type('')
|
||||
function! s:format_name(name)
|
||||
return call(s:head_format, [a:name])
|
||||
endfunction
|
||||
else
|
||||
function! s:format_name(name)
|
||||
return a:name
|
||||
endfunction
|
||||
endif
|
||||
|
||||
let s:git_dirs = {}
|
||||
function! s:get_git_branch(path)
|
||||
if has_key(s:git_dirs, a:path)
|
||||
@ -72,6 +87,8 @@ function! airline#extensions#branch#head()
|
||||
let b:airline_head = ''
|
||||
endif
|
||||
|
||||
let b:airline_head = s:format_name(b:airline_head)
|
||||
|
||||
if exists("g:airline#extensions#branch#displayed_head_limit")
|
||||
let w:displayed_head_limit = g:airline#extensions#branch#displayed_head_limit
|
||||
if len(b:airline_head) > w:displayed_head_limit - 1
|
||||
|
@ -0,0 +1,18 @@
|
||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
let s:padding = s:spc . s:spc . s:spc
|
||||
|
||||
function! airline#extensions#ctrlspace#statusline(...)
|
||||
let b = airline#builder#new({ 'active': 1 })
|
||||
call b.add_section('airline_a', s:padding . g:ctrlspace_symbols.cs . s:padding)
|
||||
call b.add_section('airline_b', s:padding . ctrlspace#statusline_mode_segment(s:padding))
|
||||
call b.split()
|
||||
call b.add_section('airline_x', s:spc . ctrlspace#statusline_tab_segment() . s:spc)
|
||||
return b.build()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ctrlspace#init(ext)
|
||||
let g:ctrlspace_statusline_function = 'airline#extensions#ctrlspace#statusline()'
|
||||
endfunction
|
@ -5,6 +5,12 @@ let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default')
|
||||
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:taboo = get(g:, 'airline#extensions#taboo#enabled', 1) && get(g:, 'loaded_taboo', 0)
|
||||
if s:taboo
|
||||
let g:taboo_tabline = 0
|
||||
endif
|
||||
|
||||
|
||||
function! airline#extensions#tabline#init(ext)
|
||||
if has('gui_running')
|
||||
set guioptions-=e
|
||||
@ -72,9 +78,18 @@ function! airline#extensions#tabline#get()
|
||||
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])
|
||||
let title = ''
|
||||
if s:taboo
|
||||
let title = TabooTabTitle(a:n)
|
||||
endif
|
||||
|
||||
if empty(title)
|
||||
let buflist = tabpagebuflist(a:n)
|
||||
let winnr = tabpagewinnr(a:n)
|
||||
return airline#extensions#tabline#get_buffer_name(buflist[winnr - 1])
|
||||
endif
|
||||
|
||||
return title
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#get_buffer_name(nr)
|
||||
|
@ -172,6 +172,14 @@ function! s:select_tab(buf_index)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:jump_to_tab(offset)
|
||||
let l = s:current_visible_buffers
|
||||
let i = index(l, bufnr('%'))
|
||||
if i > -1
|
||||
exec 'b!' . l[float2nr(fmod(i + a:offset, len(l)))]
|
||||
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>
|
||||
@ -182,4 +190,6 @@ if s:buffer_idx_mode
|
||||
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>
|
||||
noremap <unique> <Plug>AirlineSelectPrevTab :<C-u>call <SID>jump_to_tab(-v:count1)<CR>
|
||||
noremap <unique> <Plug>AirlineSelectNextTab :<C-u>call <SID>jump_to_tab(v:count1)<CR>
|
||||
endif
|
||||
|
@ -23,5 +23,10 @@ function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffer
|
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(bufname(nr), ':p:.'))
|
||||
endfor
|
||||
|
||||
return map[a:bufnr]
|
||||
if has_key(map, a:bufnr)
|
||||
return map[a:bufnr]
|
||||
endif
|
||||
|
||||
" if we get here, the buffer list isn't in sync with the selected buffer yet, fall back to the default
|
||||
return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers)
|
||||
endfunction
|
||||
|
@ -55,9 +55,11 @@ function! airline#extensions#tabline#tabs#get()
|
||||
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).'%{len(tabpagebuflist('.i.'))}'
|
||||
elseif s:tab_nr_type == 1
|
||||
let val .= (g:airline_symbols.space).i
|
||||
else "== 2
|
||||
let val .= (g:airline_symbols.space).i.'.%{len(tabpagebuflist('.i.'))}'
|
||||
endif
|
||||
endif
|
||||
call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)')
|
||||
|
Reference in New Issue
Block a user