feat(fzf): various improvements (#275)

* use fzf#wrap to repect user config
* show the first item at the top
* a space after index
This commit is contained in:
Jaehwang Jung 2023-07-12 00:37:07 +09:00 committed by GitHub
parent 603ffde23a
commit 66078ea0fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View file

@ -3,12 +3,11 @@ function! aerial#fzf() abort
if type(l:labels) == type(v:null) && l:labels == v:null
return
endif
call fzf#run({
call fzf#run(fzf#wrap({
\ 'source': l:labels,
\ 'sink': funcref('aerial#goto_symbol'),
\ 'options': '--prompt="Document symbols: "',
\ 'window': {'width': 0.5, 'height': 0.4},
\ })
\ 'options': ['--prompt="Document symbols: "', '--layout=reverse-list'],
\ }))
endfunction
function! aerial#goto_symbol(symbol) abort

View file

@ -15,7 +15,7 @@ M.get_labels = function(opts)
local results = {}
if data.has_symbols(0) then
for _, item in data.get_or_create(0):iter({ skip_hidden = false }) do
local label = string.format("%d:%s", item.idx, item.name)
local label = string.format("%d: %s", item.idx, item.name)
table.insert(results, label)
end
end