1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated plugins

This commit is contained in:
amix
2014-07-02 12:18:18 +01:00
parent 6a16a9393c
commit 1dba960b75
156 changed files with 2657 additions and 1234 deletions

View File

@ -42,7 +42,7 @@ function! airline#extensions#branch#head()
let b:airline_head = fugitive#head()
if empty(b:airline_head) && !exists('b:git_dir')
let b:airline_head = s:get_git_branch(getcwd())
let b:airline_head = s:get_git_branch(expand("%:p:h"))
endif
endif
@ -65,6 +65,13 @@ function! airline#extensions#branch#head()
let b:airline_head = ''
endif
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
let b:airline_head = b:airline_head[0:w:displayed_head_limit - 1].'…'
endif
endif
return b:airline_head
endfunction

View File

@ -1,7 +1,7 @@
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0)
if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0)
finish
endif
@ -27,6 +27,19 @@ function! s:get_hunks_gitgutter()
return GitGutterGetHunkSummary()
endfunction
function! s:get_hunks_changes()
if !get(b:, 'changes_view_enabled', 0) || s:is_branch_empty()
return []
endif
let hunks = changes#GetStats()
for i in hunks
if i > 0
return hunks
endif
endfor
return []
endfunction
function! s:get_hunks_empty()
return ''
endfunction
@ -38,6 +51,8 @@ function! s:get_hunks()
let s:source_func = 's:get_hunks_signify'
elseif exists('*GitGutterGetHunkSummary')
let s:source_func = 's:get_hunks_gitgutter'
elseif exists('*changes#GetStats')
let s:source_func = 's:get_hunks_changes'
else
let s:source_func = 's:get_hunks_empty'
endif

View File

@ -0,0 +1,54 @@
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
if !get(g:, 'loaded_nrrw_rgn', 0)
finish
endif
function! airline#extensions#nrrwrgn#apply(...)
if exists(":WidenRegion") == 2
let spc = g:airline_symbols.space
if !exists("*nrrwrgn#NrrwRgnStatus()") || empty(nrrwrgn#NrrwRgnStatus())
call a:1.add_section('airline_a', printf('%s[Narrowed%s#%d]', spc, spc, b:nrrw_instn))
let bufname=(get(b:, 'orig_buf', 0) ? bufname(b:orig_buf) : substitute(bufname('%'), '^Nrrwrgn_\zs.*\ze_\d\+$', submatch(0), ''))
call a:1.add_section('airline_c', spc.bufname.spc)
call a:1.split()
else
let dict=nrrwrgn#NrrwRgnStatus()
let vmode = { 'v': 'Char ', 'V': 'Line ', '': 'Block '}
let mode = dict.visual ? vmode[dict.visual] : vmode['V']
let winwidth = winwidth(0)
if winwidth < 80
let mode = mode[0]
endif
let title = (winwidth < 80 ? "Nrrw" : "Narrowed ")
let multi = (winwidth < 80 ? 'M' : 'Multi')
call a:1.add_section('airline_a', printf('[%s%s%s#%d]%s', (dict.multi ? multi : ""),
\ title, mode, b:nrrw_instn, spc))
let name = dict.fullname
if name !=# '[No Name]'
if winwidth > 100
" need some space
let name = fnamemodify(dict.fullname, ':~')
if strlen(name) > 8
" shorten name
let name = substitute(name, '\(.\)[^/\\]*\([/\\]\)', '\1\2', 'g')
endif
else
let name = fnamemodify(dict.fullname, ':t')
endif
endif
let range=(dict.multi ? '' : printf("[%d-%d]", dict.start[1], dict.end[1]))
call a:1.add_section('airline_c', printf("%s %s %s", name, range, dict.enabled ? "\u2713" : '!'))
call a:1.split()
call a:1.add_section('airline_x', get(g:, 'airline_section_x').spc)
call a:1.add_section('airline_y', spc.get(g:, 'airline_section_y').spc)
call a:1.add_section('airline_z', spc.get(g:, 'airline_section_z'))
endif
return 1
endif
endfunction
function! airline#extensions#nrrwrgn#init(ext)
call a:ext.add_statusline_func('airline#extensions#nrrwrgn#apply')
endfunction

View File

@ -14,9 +14,9 @@ function! airline#extensions#tabline#unique_tail_improved#format(bufnr, buffers)
for nr in a:buffers
let name = bufname(nr)
if !empty(name) && nr != a:bufnr && fnamemodify(name, ':t') == curbuf_tail
if !empty(name) && nr != a:bufnr && fnamemodify(name, ':t') == curbuf_tail " only perform actions if curbuf_tail isn't unique
let do_deduplicate = 1
let tokens = reverse(split(substitute(fnamemodify(name, ':p:.:h'), '\\', '/', 'g'), '/'))
let tokens = reverse(split(substitute(fnamemodify(name, ':p:h'), '\\', '/', 'g'), '/'))
let token_index = 0
for token in tokens
if token == '' | continue | endif
@ -33,7 +33,7 @@ function! airline#extensions#tabline#unique_tail_improved#format(bufnr, buffers)
if do_deduplicate == 1
let path = []
let token_index = 0
for token in reverse(split(substitute(fnamemodify(bufname(a:bufnr), ':p:.:h'), '\\', '/', 'g'), '/'))
for token in reverse(split(substitute(fnamemodify(bufname(a:bufnr), ':p:h'), '\\', '/', 'g'), '/'))
if token == '.' | break | endif
let duplicated = 0
let uniq = 1

View File

@ -15,10 +15,25 @@ let s:default_checks = ['indent', 'trailing']
let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', 'trailing[%s]')
let s:mixed_indent_format = get(g:, 'airline#extensions#whitespace#mixed_indent_format', 'mixed-indent[%s]')
let s:indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000)
let s:enabled = 1
let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1)
function! s:check_mixed_indent()
if s:indent_algo == 1
" [<tab>]<space><tab>
" spaces before or between tabs are not allowed
let t_s_t = '(^\t* +\t\s*\S)'
" <tab>(<space> x count)
" count of spaces at the end of tabs should be less then tabstop value
let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)'
return search('\v' . t_s_t . '|' . t_l_s, 'nw')
else
return search('\v(^\t+ +)|(^ +\t+)', 'nw')
endif
endfunction
function! airline#extensions#whitespace#check()
if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines
@ -36,13 +51,7 @@ function! airline#extensions#whitespace#check()
let mixed = 0
if index(checks, 'indent') > -1
" [<tab>]<space><tab>
" Spaces before or between tabs are not allowed
let t_s_t = '(^\t* +\t\s*\S)'
" <tab>(<space> x count)
" Count of spaces at the end of tabs should be less then tabstop value
let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)'
let mixed = search('\v' . t_s_t . '|' . t_l_s, 'nw')
let mixed = s:check_mixed_indent()
endif
if trailing != 0 || mixed != 0
@ -62,13 +71,23 @@ endfunction!
function! airline#extensions#whitespace#toggle()
if s:enabled
autocmd! airline_whitespace CursorHold,BufWritePost
augroup airline_whitespace
autocmd!
augroup END
augroup! airline_whitespace
let s:enabled = 0
else
call airline#extensions#whitespace#init()
let s:enabled = 1
endif
if exists("g:airline#extensions#whitespace#enabled")
let g:airline#extensions#whitespace#enabled = s:enabled
if s:enabled && match(g:airline_section_warning, '#whitespace#check') < 0
let g:airline_section_warning .= airline#section#create(['whitespace'])
call airline#update_statusline()
endif
endif
echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled')
endfunction