improve mbox telescope picker sorter

This commit is contained in:
Clément DOUIN 2021-04-24 23:45:21 +02:00
parent 17df485e19
commit f1e339d720
No known key found for this signature in database
GPG key ID: 69C9B9CFFDEE2DEF
2 changed files with 8 additions and 3 deletions

View file

@ -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"

View file

@ -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()