nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.96k stars 838 forks source link

Reverse (mirrored) layout for picker results: show items from top to bottom #1419

Closed wookayin closed 3 years ago

wookayin commented 3 years ago

Is your feature request related to a problem? Please describe.

The results window of the picker displays the first, top-score item matched in the bottom, like the following screenshot:

image

even when I set layout_config.prompt_position = 'top'.

But this bottom-to-top order doesn't make much sense if one want to place the prompt in the top area. What I would like to achieve is to have a 'reverse' layout (what should I call it exactly?) similar to this (fzf --layout=reverse):

image

i.e., the first matched item appears in the top (closer to the prompt).

Describe the solution you'd like

Please add a configuration point to allow such a 'reverse' or 'mirrored' layout for the picker.

Describe alternatives you've considered

Additional context

FZF, for example, has an option for this:

let $FZF_DEFAULT_OPTS = ' --layout=reverse'
Conni2461 commented 3 years ago

:help telescope.defaults.sorting_strategy

wookayin commented 3 years ago

My bad I missed that option. What I needed is:

defaults = {
   ...
   sorting_strategy = 'ascending',            -- default is 'descending'
   ...
}

I was searching the documentation, googling for around 20 mins but unable to find it ...... because it is named differently in telescope's world. (Should we improve the doc?) Thank you for the help, and I hope this issue will be helpful for somebody like me in the future.

Conni2461 commented 3 years ago

Maybe finally writing this wiki entry: https://github.com/nvim-telescope/telescope.nvim/wiki/Switching-from-fzf-to-telescope

kirillrogovoy commented 2 months ago

Just wanted to add that I've also just spent 15-20 minutes to find this solution. And most of that was actually reading parts of :help telescope 😅