Skip to content

add sort_candidates_reverse feature#74

Open
ompugao wants to merge 2 commits intotacahiroy:masterfrom
ompugao:add_sort_reverse
Open

add sort_candidates_reverse feature#74
ompugao wants to merge 2 commits intotacahiroy:masterfrom
ompugao:add_sort_reverse

Conversation

@ompugao
Copy link

@ompugao ompugao commented Aug 5, 2015

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.

@tacahiroy
Copy link
Owner

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.

@ompugao
Copy link
Author

ompugao commented Aug 7, 2015

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

i prefer
ctrlp-funky-reversed<script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script>
to
ctrlp-funky-normal<script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script>

@ompugao
Copy link
Author

ompugao commented Aug 7, 2015

ah, thanks for your advice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants