mirror of
https://github.com/amix/vimrc
synced 2025-07-01 20:55:00 +08:00
Updated plugins
This commit is contained in:
@ -73,7 +73,7 @@ function! s:get_git_untracked(file)
|
||||
if has_key(s:untracked_git, a:file)
|
||||
let untracked = s:untracked_git[a:file]
|
||||
else
|
||||
let output = system('git status --porcelain -- '. a:file)
|
||||
let output = system('git status --porcelain -- '. shellescape(a:file))
|
||||
if output[0:1] is# '??' && output[3:-2] is? a:file
|
||||
let untracked = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
|
||||
endif
|
||||
@ -92,7 +92,7 @@ function! s:get_hg_untracked(file)
|
||||
if has_key(s:untracked_hg, a:file)
|
||||
let untracked = s:untracked_hg[a:file]
|
||||
else
|
||||
let untracked = (system('hg status -u -- '. a:file)[0] is# '?' ?
|
||||
let untracked = (system('hg status -u -- '. shellescape(a:file))[0] is# '?' ?
|
||||
\ get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists) : '')
|
||||
let s:untracked_hg[a:file] = untracked
|
||||
endif
|
||||
|
@ -22,6 +22,9 @@ function! s:get_section(winnr, key, ...)
|
||||
endif
|
||||
endif
|
||||
let spc = g:airline_symbols.space
|
||||
if !exists('g:airline_section_{a:key}')
|
||||
return ''
|
||||
endif
|
||||
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
|
||||
@ -40,7 +43,7 @@ endfunction
|
||||
" deactivate it, until this is properly fixed:
|
||||
" https://groups.google.com/d/msg/vim_dev/sb1jmVirXPU/mPhvDnZ-CwAJ
|
||||
if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch81')))
|
||||
function s:add_section(builder, context, key)
|
||||
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 == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key)))
|
||||
@ -56,7 +59,7 @@ if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch8
|
||||
endfunction
|
||||
else
|
||||
" older version don't like the use of %(%)
|
||||
function s:add_section(builder, context, key)
|
||||
function! s:add_section(builder, context, key)
|
||||
if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key)))
|
||||
return
|
||||
endif
|
||||
|
@ -15,6 +15,13 @@ endfunction
|
||||
|
||||
function! airline#extensions#quickfix#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#quickfix#apply')
|
||||
call a:ext.add_inactive_statusline_func('airline#extensions#quickfix#inactive_qf_window')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#quickfix#inactive_qf_window(...)
|
||||
if getbufvar(a:2.bufnr, '&filetype') is# 'qf' && !empty(getwinvar(a:2.winnr, 'quickfix_title', ''))
|
||||
call setwinvar(a:2.winnr, 'airline_section_c', '[%{get(w:, "quickfix_title", "")}] %f %m')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:get_text()
|
||||
|
@ -73,7 +73,7 @@ function! airline#extensions#tabline#buffers#get()
|
||||
|
||||
" Neovim feature: Have clickable buffers
|
||||
if has("tablineat")
|
||||
call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#switchbuf@')
|
||||
call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#clickbuf@')
|
||||
endif
|
||||
if s:buffer_idx_mode
|
||||
if len(s:number_map) > 0
|
||||
@ -180,7 +180,7 @@ function! s:jump_to_tab(offset)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function s:map_keys()
|
||||
function! s:map_keys()
|
||||
if s:buffer_idx_mode
|
||||
noremap <silent> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR>
|
||||
@ -196,10 +196,18 @@ function s:map_keys()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function airline#extensions#tabline#buffers#switchbuf(minwid, clicks, button, modifiers) abort
|
||||
" Run the following code only on a single left mouse button click without modifiers pressed
|
||||
function! airline#extensions#tabline#buffers#clickbuf(minwid, clicks, button, modifiers) abort
|
||||
" Clickable buffers
|
||||
" works only in recent NeoVim with has('tablineat')
|
||||
if a:clicks == 1 && a:button is# 'l' && a:modifiers !~# '[^ ]'
|
||||
sil execute 'buffer' a:minwid
|
||||
|
||||
" single mouse button click without modifiers pressed
|
||||
if a:clicks == 1 && a:modifiers !~# '[^ ]'
|
||||
if a:button is# 'l'
|
||||
" left button - switch to buffer
|
||||
silent execute 'buffer' a:minwid
|
||||
elseif a:button is# 'm'
|
||||
" middle button - delete buffer
|
||||
silent execute 'bdelete' a:minwid
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
@ -94,7 +94,7 @@ function! airline#extensions#tabline#tabs#get()
|
||||
return s:current_tabline
|
||||
endfunction
|
||||
|
||||
function s:map_keys()
|
||||
function! s:map_keys()
|
||||
noremap <silent> <Plug>AirlineSelectTab1 :1tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab2 :2tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab3 :3tabn<CR>
|
||||
|
@ -13,12 +13,9 @@ let s:long_format = get(g:, 'airline#extensions#whitespace#long_format', 'long[%
|
||||
let s:mixed_indent_file_format = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', 'mix-indent-file[%s]')
|
||||
let s:indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
|
||||
let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] }
|
||||
|
||||
let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000)
|
||||
|
||||
let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1)
|
||||
|
||||
let s:c_like_langs = ['c', 'cpp', 'cuda', 'java', 'javascript', 'ld']
|
||||
let s:c_like_langs = get(g:, 'airline#extensions#c_like_langs', [ 'c', 'cpp', 'cuda', 'javascript', 'ld', 'php' ])
|
||||
|
||||
function! s:check_mixed_indent()
|
||||
if s:indent_algo == 1
|
||||
@ -139,7 +136,13 @@ function! airline#extensions#whitespace#init(...)
|
||||
unlet! b:airline_whitespace_check
|
||||
augroup airline_whitespace
|
||||
autocmd!
|
||||
autocmd CursorHold,BufWritePost * unlet! b:airline_whitespace_check
|
||||
autocmd CursorHold,BufWritePost * call <sid>ws_refresh()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! s:ws_refresh()
|
||||
unlet! b:airline_whitespace_check
|
||||
if get(g:, 'airline_skip_empty_sections', 0)
|
||||
exe ':AirlineRefresh'
|
||||
endif
|
||||
endfunction
|
||||
|
@ -48,7 +48,7 @@ function! s:wordcount()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function s:get_decimal_group()
|
||||
function! s:get_decimal_group()
|
||||
if match(v:lang, '\v\cC|en') > -1
|
||||
return ','
|
||||
elseif match(v:lang, '\v\cde|dk|fr|pt') > -1
|
||||
|
Reference in New Issue
Block a user