mirror of
https://github.com/junegunn/fzf.vim.git
synced 2026-01-27 13:22:19 +08:00
Add :BMarks command (#1593)
And allow passing arguments of :marks to :Marks command. Close #1158. Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
This commit is contained in:
@@ -1362,15 +1362,25 @@ function! s:mark_sink(lines)
|
||||
execute 'normal! `'.matchstr(a:lines[1], '\S').'zz'
|
||||
endfunction
|
||||
|
||||
function! fzf#vim#marks(...)
|
||||
function! fzf#vim#marks(...) abort
|
||||
let [initial_marks, extra] = (a:0 && type(a:1) == type('')) ?
|
||||
\ [a:1, a:000[1:]] : ['', a:000]
|
||||
|
||||
redir => cout
|
||||
silent marks
|
||||
execute 'silent! marks' initial_marks
|
||||
redir END
|
||||
|
||||
let list = split(cout, "\n")
|
||||
|
||||
" If first line is not the expected header, no marks found
|
||||
if empty(list) || list[0] =~# '^E'
|
||||
return s:warn('No marks found')
|
||||
endif
|
||||
|
||||
return s:fzf('marks', {
|
||||
\ 'source': extend(list[0:0], map(list[1:], 's:format_mark(v:val)')),
|
||||
\ 'source': extend(list[0:0], map(list[1:], 's:format_mark(v:val)')),
|
||||
\ 'sink*': s:function('s:mark_sink'),
|
||||
\ 'options': '+m -x --ansi --tiebreak=index --header-lines 1 --tiebreak=begin --prompt "Marks> "'}, a:000)
|
||||
\ 'options': '+m -x --ansi --tiebreak=index --header-lines 1 --tiebreak=begin --prompt "Marks> "'}, extra)
|
||||
endfunction
|
||||
|
||||
" ------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user