ctrlp-funky icon indicating copy to clipboard operation
ctrlp-funky copied to clipboard

add sort_candidates_reverse feature

Open ompugao opened this issue 10 years ago • 3 comments

I want kind of this reverse-sorting feature in ctrlp-funky.

function 's:sort_candidates_reverse' is almost all the same as function 's:sort_candidates', I know it's not clean.

could you tell how i should fix this pull-req? or, could you revise and merge this into master?

thanks.

ompugao avatar Aug 05 '15 13:08 ompugao

Simply, like this change is enough to do the job in this case, IMHO:

--- i/autoload/ctrlp/funky.vim
+++ w/autoload/ctrlp/funky.vim
@@ -300,6 +300,9 @@ function! ctrlp#funky#extract(bufnr, patterns)
     endfor

     let sorted = sort(candidates, function('s:sort_candidates'))
+    if s:sort_reverse
+      let sorted = reverse(sorted)
+    endif
     let prior = map(sort(mru, function('s:sort_mru')), 'v:val[0]')

     if s:use_cache && s:fu.is_real_file(a:bufnr)

I'm curious why do you want to have this feature.

tacahiroy avatar Aug 07 '15 12:08 tacahiroy

i want ctrlp-funky to organize a list in the same order as I can see in the file.

i prefer ctrlp-funky-reversed to ctrlp-funky-normal

ompugao avatar Aug 07 '15 14:08 ompugao

ah, thanks for your advice

ompugao avatar Aug 07 '15 14:08 ompugao