Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sort_candidates_reverse feature #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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