mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-07 21:24:40 +08:00
@@ -71,6 +71,7 @@ Commands
|
|||||||
| `:BLines [QUERY]` | Lines in the current buffer |
|
| `:BLines [QUERY]` | Lines in the current buffer |
|
||||||
| `:Tags [QUERY]` | Tags in the project (`ctags -R`) |
|
| `:Tags [QUERY]` | Tags in the project (`ctags -R`) |
|
||||||
| `:BTags [QUERY]` | Tags in the current buffer |
|
| `:BTags [QUERY]` | Tags in the current buffer |
|
||||||
|
| `:Changes` | Changelist across all open buffers |
|
||||||
| `:Marks` | Marks |
|
| `:Marks` | Marks |
|
||||||
| `:Jumps` | Jumps |
|
| `:Jumps` | Jumps |
|
||||||
| `:Windows` | Windows |
|
| `:Windows` | Windows |
|
||||||
|
|||||||
@@ -1164,6 +1164,62 @@ function! fzf#vim#commands(...)
|
|||||||
\ ' --tiebreak=index --header-lines 1 -x --prompt "Commands> " -n2,3,2..3 -d'.s:nbs}, a:000)
|
\ ' --tiebreak=index --header-lines 1 -x --prompt "Commands> " -n2,3,2..3 -d'.s:nbs}, a:000)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" ------------------------------------------------------------------
|
||||||
|
" Changes
|
||||||
|
" ------------------------------------------------------------------
|
||||||
|
|
||||||
|
function! s:format_change(bufnr, offset, item)
|
||||||
|
return printf("%3d %s %4d %3d %s", a:bufnr, s:yellow(printf('%6s', a:offset)), a:item.lnum, a:item.col, getbufline(a:bufnr, a:item.lnum)[0])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:changes_sink(lines)
|
||||||
|
if len(a:lines) < 2
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:action_for(a:lines[0])
|
||||||
|
let [b, o, l, c] = split(a:lines[1])[0:3]
|
||||||
|
|
||||||
|
if o == '-'
|
||||||
|
execute 'buffer' b
|
||||||
|
call cursor(l, c)
|
||||||
|
elseif o[0] == '+'
|
||||||
|
execute 'normal!' o[1:].'g,'
|
||||||
|
else
|
||||||
|
execute 'normal!' o.'g;'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:format_change_offset(current, index, cursor)
|
||||||
|
if !a:current
|
||||||
|
return '-'
|
||||||
|
endif
|
||||||
|
|
||||||
|
let offset = a:index - a:cursor + 1
|
||||||
|
if offset < 0
|
||||||
|
return '+'.-offset
|
||||||
|
endif
|
||||||
|
return offset
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! fzf#vim#changes(...)
|
||||||
|
let all_changes = ["buf offset line col text"]
|
||||||
|
let cursor = 0
|
||||||
|
for bufnr in fzf#vim#_buflisted_sorted()
|
||||||
|
let [changes, position_or_length] = getchangelist(bufnr)
|
||||||
|
let current = bufnr() == bufnr
|
||||||
|
if current
|
||||||
|
let cursor = len(changes) - position_or_length
|
||||||
|
endif
|
||||||
|
let all_changes += map(reverse(changes), { idx, val -> s:format_change(bufnr, s:format_change_offset(current, idx, cursor), val) })
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return s:fzf('changes', {
|
||||||
|
\ 'source': all_changes,
|
||||||
|
\ 'sink*': s:function('s:changes_sink'),
|
||||||
|
\ 'options': printf('+m -x --ansi --tiebreak=index --header-lines=1 --cycle --scroll-off 999 --sync --bind start:pos:%d --prompt "Changes> "', cursor)}, a:000)
|
||||||
|
endfunction
|
||||||
|
|
||||||
" ------------------------------------------------------------------
|
" ------------------------------------------------------------------
|
||||||
" Marks
|
" Marks
|
||||||
" ------------------------------------------------------------------
|
" ------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
fzf-vim.txt fzf-vim Last change: September 6 2023
|
fzf-vim.txt fzf-vim Last change: September 14 2023
|
||||||
FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-toc*
|
FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-toc*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
@@ -103,9 +103,9 @@ so you can omit it if you use a plugin manager that doesn't support hooks.
|
|||||||
COMMANDS *fzf-vim-commands*
|
COMMANDS *fzf-vim-commands*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
*:Files* *:GFiles* *:Buffers* *:Colors* *:Ag* *:Rg* *:RG* *:Lines* *:BLines* *:Tags* *:BTags* *:Marks*
|
*:Files* *:GFiles* *:Buffers* *:Colors* *:Ag* *:Rg* *:RG* *:Lines* *:BLines* *:Tags* *:BTags*
|
||||||
*:Jumps* *:Windows* *:Locate* *:History* *:Snippets* *:Commits* *:BCommits* *:Commands* *:Maps*
|
*:Changes* *:Marks* *:Jumps* *:Windows* *:Locate* *:History* *:Snippets* *:Commits* *:BCommits*
|
||||||
*:Helptags* *:Filetypes*
|
*:Commands* *:Maps* *:Helptags* *:Filetypes*
|
||||||
|
|
||||||
-----------------------+--------------------------------------------------------------------------------------
|
-----------------------+--------------------------------------------------------------------------------------
|
||||||
Command | List ~
|
Command | List ~
|
||||||
@@ -122,6 +122,7 @@ COMMANDS *fzf-vim-commands*
|
|||||||
`:BLines [QUERY]` | Lines in the current buffer
|
`:BLines [QUERY]` | Lines in the current buffer
|
||||||
`:Tags [QUERY]` | Tags in the project ( `ctags -R` )
|
`:Tags [QUERY]` | Tags in the project ( `ctags -R` )
|
||||||
`:BTags [QUERY]` | Tags in the current buffer
|
`:BTags [QUERY]` | Tags in the current buffer
|
||||||
|
`:Changes` | Changelist across all open buffers
|
||||||
`:Marks` | Marks
|
`:Marks` | Marks
|
||||||
`:Jumps` | Jumps
|
`:Jumps` | Jumps
|
||||||
`:Windows` | Windows
|
`:Windows` | Windows
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ call s:defs([
|
|||||||
\'command! -bar -bang Commands call fzf#vim#commands(<bang>0)',
|
\'command! -bar -bang Commands call fzf#vim#commands(<bang>0)',
|
||||||
\'command! -bar -bang Jumps call fzf#vim#jumps(<bang>0)',
|
\'command! -bar -bang Jumps call fzf#vim#jumps(<bang>0)',
|
||||||
\'command! -bar -bang Marks call fzf#vim#marks(<bang>0)',
|
\'command! -bar -bang Marks call fzf#vim#marks(<bang>0)',
|
||||||
|
\'command! -bar -bang Changes call fzf#vim#changes(<bang>0)',
|
||||||
\'command! -bar -bang Helptags call fzf#vim#helptags(fzf#vim#with_preview({ "placeholder": "--tag {2}:{3}:{4}" }), <bang>0)',
|
\'command! -bar -bang Helptags call fzf#vim#helptags(fzf#vim#with_preview({ "placeholder": "--tag {2}:{3}:{4}" }), <bang>0)',
|
||||||
\'command! -bar -bang Windows call fzf#vim#windows(fzf#vim#with_preview({ "placeholder": "{2}" }), <bang>0)',
|
\'command! -bar -bang Windows call fzf#vim#windows(fzf#vim#with_preview({ "placeholder": "{2}" }), <bang>0)',
|
||||||
\'command! -bar -bang -nargs=* -range=% -complete=file Commits let b:fzf_winview = winsaveview() | <line1>,<line2>call fzf#vim#commits(<q-args>, fzf#vim#with_preview({ "placeholder": "" }), <bang>0)',
|
\'command! -bar -bang -nargs=* -range=% -complete=file Commits let b:fzf_winview = winsaveview() | <line1>,<line2>call fzf#vim#commits(<q-args>, fzf#vim#with_preview({ "placeholder": "" }), <bang>0)',
|
||||||
|
|||||||
Reference in New Issue
Block a user