mirror of
https://github.com/junegunn/fzf.vim.git
synced 2026-03-01 21:07:01 +08:00
@@ -402,8 +402,13 @@ function! s:format_buffer(b)
|
|||||||
return s:strip(printf("[%s] %s\t%s\t%s", s:yellow(a:b), flag, name, extra))
|
return s:strip(printf("[%s] %s\t%s\t%s", s:yellow(a:b), flag, name, extra))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:sort_buffers(...)
|
||||||
|
let [b1, b2] = map(copy(a:000), 'get(g:fzf#vim#buffers, v:val, v:val)')
|
||||||
|
return b1 - b2
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! fzf#vim#buffers(...)
|
function! fzf#vim#buffers(...)
|
||||||
let bufs = map(s:buflisted(), 's:format_buffer(v:val)')
|
let bufs = map(sort(s:buflisted(), 's:sort_buffers'), 's:format_buffer(v:val)')
|
||||||
return s:fzf(fzf#vim#wrap({
|
return s:fzf(fzf#vim#wrap({
|
||||||
\ 'source': reverse(bufs),
|
\ 'source': reverse(bufs),
|
||||||
\ 'sink*': s:function('s:bufopen'),
|
\ 'sink*': s:function('s:bufopen'),
|
||||||
|
|||||||
@@ -112,6 +112,13 @@ if has('nvim') && get(g:, 'fzf_nvim_statusline', 1)
|
|||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let g:fzf#vim#buffers = {}
|
||||||
|
augroup fzf_buffers
|
||||||
|
autocmd!
|
||||||
|
autocmd BufWinEnter,WinEnter * let g:fzf#vim#buffers[bufnr('')] = localtime()
|
||||||
|
autocmd BufDelete * silent! call remove(g:fzf#vim#buffers, expand('<abuf>'))
|
||||||
|
augroup END
|
||||||
|
|
||||||
inoremap <expr> <plug>(fzf-complete-word) fzf#vim#complete#word()
|
inoremap <expr> <plug>(fzf-complete-word) fzf#vim#complete#word()
|
||||||
inoremap <expr> <plug>(fzf-complete-path) fzf#vim#complete#path("find . -path '*/\.*' -prune -o -print \| sed '1d;s:^..::'")
|
inoremap <expr> <plug>(fzf-complete-path) fzf#vim#complete#path("find . -path '*/\.*' -prune -o -print \| sed '1d;s:^..::'")
|
||||||
inoremap <expr> <plug>(fzf-complete-file) fzf#vim#complete#path("find . -path '*/\.*' -prune -o -type f -print -o -type l -print \| sed 's:^..::'")
|
inoremap <expr> <plug>(fzf-complete-file) fzf#vim#complete#path("find . -path '*/\.*' -prune -o -type f -print -o -type l -print \| sed 's:^..::'")
|
||||||
|
|||||||
Reference in New Issue
Block a user