From f1e339d720df605fe4844d7d399f76c091224037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Sat, 24 Apr 2021 23:45:21 +0200 Subject: [PATCH] improve mbox telescope picker sorter --- vim/autoload/himalaya/mbox.vim | 9 +++++++-- vim/lua/himalaya/mbox.lua | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/vim/autoload/himalaya/mbox.vim b/vim/autoload/himalaya/mbox.vim index e9f6d67..7692cde 100644 --- a/vim/autoload/himalaya/mbox.vim +++ b/vim/autoload/himalaya/mbox.vim @@ -44,13 +44,18 @@ function! s:native_picker(mboxes) call himalaya#mbox#post_input(a:mboxes[choice]) endfunction -let s:pickers = {"telescope": function("s:telescope_picker"), "fzf": function("s:fzf_picker"), "native": function("s:native_picker")} +let s:pickers = { + \"telescope": function("s:telescope_picker"), + \"fzf": function("s:fzf_picker"), + \"native": function("s:native_picker"), +\} function! himalaya#mbox#input() try let mboxes = map(s:cli("mailboxes", [], "Fetching mailboxes", 0), "v:val.name") - if exists("g:himalaya_mailbox_picker") " Get user choice for picker, otherwise check runtimepath + " Get user choice for picker, otherwise check runtimepath + if exists("g:himalaya_mailbox_picker") let mbox_picker = g:himalaya_mailbox_picker else if &rtp =~ "telescope" diff --git a/vim/lua/himalaya/mbox.lua b/vim/lua/himalaya/mbox.lua index c1daaa8..941eb82 100644 --- a/vim/lua/himalaya/mbox.lua +++ b/vim/lua/himalaya/mbox.lua @@ -40,7 +40,7 @@ M.mbox_picker = function(mboxes) pickers.new { results_title = 'Mailboxes', finder = finders.new_table(finder_opts), - sorter = sorters.fuzzy_with_index_bias(), + sorter = sorters.get_generic_fuzzy_sorter(), attach_mappings = function(prompt_bufnr) actions.select_default:replace(function() local selection = action_state.get_selected_entry()